Skip to content

Instantly share code, notes, and snippets.

@bennadel
Created August 3, 2012 13:38
Using The Quality Attribute With The CFImage WriteToBrowser Action
<!--- Convert PNG to JPG on the fly and write IMG tag to browser. --->
<cfimage
action="writeToBrowser"
source="#pngFilePath#"
format="jpg"
/>
<!--- Read in our PNG image. --->
<cfset png = imageNew( "./pull.png" ) />
<!--- Write out as a JPG (default settings). --->
<cfimage
action="writeToBrowser"
source="#png#"
format="jpg"
/>
<br />
<br />
<!--- Write out as a JPG at 100% (using "quality" attribute). --->
<cfimage
action="writeToBrowser"
source="#png#"
format="jpg"
quality="1"
/>
<br />
<br />
<!--- Write out as a JPG at 20% (using "quality" attribute). --->
<cfimage
action="writeToBrowser"
source="#png#"
format="jpg"
quality=".2"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment