How to crop a ColdFusion image to a specified rectangular area

ImageCrop() - crop a coldfusion image to a specified rectangular area

ImageCrop.cfm


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ImageCrop function example: how to crop a coldfusion image to a specified rectangular area</title>
</head>

<body>
<h2 style="color:Crimson">ImageCrop Function Example</h2>

<cfimage source="Test.jpg" name="TestImage">

<cfset ImageCrop(TestImage,250,10,250,300)>


<cfimage source="#TestImage#" action="write" destination="ModifiedTestImage.gif" overwrite="yes">

<img src="Test.jpg"/>
<img src="ModifiedTestImage.gif"/>
</body>
</html>





More ColdFusion example