and this works in 64-bit
'include "Freeimage.inc"
'include "RTL64.inc"
type FREE_IMAGE_FORMAT as long
enum
FIF_UNKNOWN = -1
FIF_BMP = 0
FIF_ICO = 1
FIF_JPEG = 2
FIF_JNG = 3
FIF_KOALA = 4
FIF_LBM = 5
FIF_IFF = FIF_LBM
FIF_MNG = 6
FIF_PBM = 7
FIF_PBMRAW = 8
FIF_PCD = 9
FIF_PCX = 10
FIF_PGM = 11
FIF_PGMRAW = 12
FIF_PNG = 13
FIF_PPM = 14
FIF_PPMRAW = 15
FIF_RAS = 16
FIF_TARGA = 17
FIF_TIFF = 18
FIF_WBMP = 19
FIF_PSD = 20
FIF_CUT = 21
FIF_XBM = 22
FIF_XPM = 23
FIF_DDS = 24
FIF_GIF = 25
FIF_HDR = 26
FIF_FAXG3 = 27
FIF_SGI = 28
FIF_EXR = 29
FIF_J2K = 30
FIF_JP2 = 31
FIF_PFM = 32
FIF_PICT = 33
FIF_RAW = 34
FIF_WEBP = 35
FIF_JXR = 36
end enum
type FREE_IMAGE_FILTER as long
type FREE_IMAGE_FILTER as long
enum
FILTER_BOX = 0
FILTER_BICUBIC = 1
FILTER_BILINEAR = 2
FILTER_BSPLINE = 3
FILTER_CATMULLROM = 4
FILTER_LANCZOS3 = 5
end enum
declare function FreeImageGetVersion lib "FreeImage.dll" Alias "FreeImage_GetVersion"() as zstring ptr
declare function FreeImage_Load lib "FreeImage.dll" Alias "FreeImage_Load" (byval fif as long, byval filename as zstring ptr, byval flags as long) as sys
declare function FreeImage_GetWidth lib "FreeImage.dll" Alias "FreeImage_GetWidth"(byval dib as sys) as ulong
declare function FreeImage_GetHeight lib "FreeImage.dll" Alias "FreeImage_GetHeight"(byval dib as sys) as ulong
declare function FreeImage_Rescale lib "FreeImage.dll" Alias "FreeImage_Rescale"(byval dib as sys, byval dst_width as long, byval dst_height as long, byval filter as long) as sys
declare function FreeImage_Save lib "FreeImage.dll" Alias "FreeImage_Save"(byval fif as long, byval dib as sys, byval filename as zstring ptr, byval flags as long) as BOOL
sys img,imr
long lx,ly,tx,ty,r
img = FreeImage_Load FIF_PNG,"world_flip.png",0
lx = FreeImage_GetWidth img
ly = FreeImage_GetHeight img
tx = lx/2
ty = ly/2
imr = FreeImage_Rescale img,tx,ty,FILTER_BOX
r = FreeImage_Save FIF_JPEG,imr,"t.jpg",0
print r
print tx " x " ty " ok"
print FreeImageGetVersion()