-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfreeimage.c
More file actions
41 lines (29 loc) · 808 Bytes
/
freeimage.c
File metadata and controls
41 lines (29 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* Compile with:
*
* gcc freeimage.c -lfreeimage
*
* */
#include <FreeImage.h>
int
main (int argc, char **argv)
{
FIBITMAP *t1;
FIBITMAP *t2;
int width;
int height;
FreeImage_Initialise (FALSE);
t1 = FreeImage_Load (FIF_TIFF, argv[1], TIFF_DEFAULT);
width = FreeImage_GetWidth (t1);
height = FreeImage_GetHeight (t1);
t2 = FreeImage_Copy (t1, 100, 100, width - 100, height - 100);
FreeImage_Unload (t1);
t1 = FreeImage_Rescale (t2, (width - 200) * 0.9, (height - 200) * 0.9,
FILTER_BILINEAR);
FreeImage_Unload (t2);
/* FreeImage does not have a sharpen operation, so we skip that.
* */
FreeImage_Save (FIF_TIFF, t1, argv[2], TIFF_DEFAULT);
FreeImage_Unload (t1);
FreeImage_DeInitialise ();
return 0;
}