Changing the format of an image in Cold Fusion with csImageFile

It is easy to use csImageFile to change the format of an image from one supported type to another. Simply load the image in the orignal format and then save or export using the new format.

The following code fragment loads a TIF image and saves it as a JPG.


The above code assumes that an instance of csImageFile has been created called "Image". When reading and writing files always use the full physical path and give the Internet Guest User account appropriate permissions to read, write or modify.

Image format conversions can sometimes lose information. For example converting GIF to JPG can lose transparency, and converting JPG to GIF can lose pixel density (DPI / Pixels per metre).