Contact Us

Alagad is located in Chapel Hill, North Carolina in the Research Triangle Park area.

Phone: 888-ALAGAD4
Fax: 888-248-7836
Email: please use our contact form

208 Calderon Dr.
Chapel Hill, NC 27516 USA

Request an Alagad proposal
Request a TaskForce consultation

Resize Images

The following source code demonstrates how to resize an image to a specific width and height using the scalePixels() method.  You can also use scalePercent() to scale images to a specific percentage of the source image.

Source Code

<!--- create the object --->
<cfset myImage = CreateObject("Component","Image") />

<!--- open the image to resize --->
<cfset myImage.readImage("d:\examples\fatherAndSon.jpg") />

<!--- resize the image to a specific width and height --->
<cfset myImage.scalePixels(100, 100) />

<!--- output the image in JPG format --->
<cfset myImage.writeImage("d:\examples\fatherAndSon-small.jpg", "jpg") />

<!--- the new images --->
<p>
<b>fatherAndSon.jpg:</b><br>
<img src="/examples/fatherAndSon.jpg">
</p>
<p>
<b>fatherAndSon-small.jpg:</b><br>
<img src="/examples/fatherAndSon-small.jpg">
</p>

Results

AIC Example - Resize Images