Do you see something wrong in the code below ?
LOCAL lcSource, lcDest
lcSource = GETPICT()
lcDest = JUSTPATH(lcSource) + "\_" + JUSTSTEM(lcSource)
LOCAL loImage AS GpImage OF HOME() + ffc/_gdiplus.vcx
loImage = NEWOBJECT("GpImage",HOME()+"ffc/_gdiplus.vcx")
loImage.CreateFromFile(lcSource)
loImage.SaveToFile(lcDest + ".png","Image/png")
That's a very simple code, that is supposed to load an image and save it as a PNG. But nothing happens ! Can you guess why ???
The SaveToFile Method from GpImage class from _gdiplus.vcx must receive as a required second parameter, the "tvCLSIDEncoder", that can be the CLSID of the encoder to use, or a MIME type, eg "image/jpeg" or "image/png". If a MIME type is specified, then the method dynamically looks up the CLSID of the appropriate encoder.
99% of us pass the MIME type, because that's easier to remember, but BE CAREFUL ! Because that parameter MIME type, is CASE SENSITIVE !
You have always to pass this parameter in lowercase !
The code above did not work because I typed "Image/png" instead of "image/png".
Man, I've lost a lot of time to find that !
*()&)(*)%@&$(@&¨!)@*(_*(&!_()&*_)(&*+_*()
By the way, the MIME (Multipurpose Internet Mail Extensions) types of the encoders built into Microsoft Windows GDI+ are as follows:
- image/bmp
- image/jpeg
- image/gif
- image/tiff
- image/png