Compressing JPEG images

To reduce the size of large files, you can convert a JPEG file to a lower quality image by using the write action of the cfimage tag. Specify a value between 0 (low) and 1 (high) for the quality attribute, as the following example shows:

<cfimage source="../cfdocs/images/artgallery/jeff05.jpg" action="write"
destination="jeff05_lq.jpg" quality="0.5" overwrite="yes">

You can perform the same operation by using the ImageWrite function:

<cfset myImage=ImageNew("jeff05.jpg")>
<cfset ImageWrite(myImage,"jeff05_lq.jpg","0.5")>

Get help faster and easier

New user?