Re: Resizing pictures
- Posted by sixs <sixs at ida.net> Dec 05, 2004
- 477 views
Thanks to you and Patrick Barnes for your help. I could get your test to run ok with my pictures. I have moved your test.ex code to a windows program and tried to run. I have trouble with the Init instruction. It checks the first statement and aborts. I mcopied the CXimage .ex and the Cximage.dll to the folder wher my program resides. I then moved them to the include folder in Euphoria folder and I still bomb off on the initialization statement. I haven't used the dll files too much so I'm not sure. Could it be windows on XP ? Anymore help would be appreciated Thanks to all jvandal mic _ wrote: > > The code below is a program i wrote using my CxImage wrapper > (available in the archives) that takes every BMP file in the current > directory, resizes them and saves them as PNG (you could save them in > BMP, JPG or something else). > > > <begin code> > > include cximage.ew > include file.e > include machine.e > include get.e > include misc.e > > > constant INITIALDIR = current_dir() > constant s = dir(INITIALDIR&"\\*.bmp") > > atom image > > -- Initialize the CXI library > if not CXI_Init() then > abort(0) > end if > > for i=1 to length(s) do > if length(s[i][D_NAME])>4 then > > -- Load an image from file > image = CXI_LoadImage(INITIALDIR&"\\"&s[i][D_NAME], > CXI_FORMAT_UNKNOWN, 0) > > -- Abort if the image couldn't be loaded > if not image then > abort(0) > end if > > CXI_Resize(image, 320, 240, CXI_GOOD_RESIZE) > > -- Save a copy of the image as PNG > if CXI_SaveImage(image, > INITIALDIR&"\\"&s[i][D_NAME][1..length(s[i][D_NAME])-3]&"png", > CXI_FORMAT_PNG) then > end if > > -- Destroy the resources allocated for the image > CXI_FreeImage(image) > end if > end for > > <end code> > > > >