Image CFC - Coldfusion Image Manipulation
Image.cfc is a coldfusion component designed to handle image manipulation with native coldfusion/java code. It is based on Jim Dew's original work but drastically improved and enhanced to be much more full featured, and to produce high quality output.
CURRENT VERSION: 2.19 Released 2007 Aug 18
- ImageCFC Home Page
- Project Page (report bugs here!)
- ImageCFC Forum
- Download (imageCFC and CAPTCHA example code)
- API Documentation
- View Example
- View CAPTCHA Example
- View Change Log (imageCFC)
- View README File (imageCFC)
This image component can:
- READ jpg, gif, and PNG files, and provide dimensions and other details.
- Images can be read from local files *OR* URLs.
- scale images to a specific width or height
- resize images to a specific width AND height
- rotate images at 90 degree angles
- flip images horizontally and vertically
- Add text overlays to images using TrueType fonts
- Watermark one image with another image
- Image filters: fast blur, gaussian blur, box blur, sharpen, posterize
- Control compression quality of JPG images.
- WRITE images in JPG and PNG format
Note: GIF files can be read and manipulated but they have to be saved as PNGs)
New in Version 2.19
REvamped, simplified writeImage() method. Bug fix where resizing indexed color PNGs didn't work. See the CHANGELOG for details.
New in Version 2.18
Version 2.18 includes improvements to handling of images where getImageType() returns 0 (ie, BufferedImage.TYPE_CUSTOM). Version 2.18 has also been fully tested on Bluedragon 7 and Coldfusion 8 (beta).
Gaussian and Box Blurs are no longer supported, and were removed.
New in Version 2.17
Version 2.17 features several minor updates added to enhance CFFM 1.16, and additional error checking to prevent problems with unknown images types. See the CHANGELOG for details.
New in Version 2.16
I wrote some test cases and actually tested imageCFC this time.
Also, you can use built in "logical" java fonts rather than referencing a truetype font file for the addText() method.
New in Version 2.15 - Image Meta Data
Thanks to the Java Loader CFC project, Drew Noakes image meta data (java) library, and some code provided by Dave Anderson, the getImageInfo() method will now return image metadata stored in JPEG files when available (like from cameras).
New in Version 2.14 - Exact Size Thumbnails
Thanks to some contributed code, there is now a new "cropToExact" argument to the resize() method. This argument, when combined with a specified width, specified height, and the preserveAspect argument being set to true will cause a image to be resized then cropped to fit exactly within the specified dimensions.
For example, this will allow you to take a 800x600 image, and create a 100x100 thumbnail while still preservign the aspect ratio. In this case, the image would be resized to 133x100, then cropped to 100x100.
New in Version 2.13 - Bug Fixes Only
New in version 2.12 - Bug Fixes Only
New in Version 2.11 - Object Orientation
The basic image.cfc has not really changed. It's still very function oriented.
To simply things, I created an object oriented "wrapper" called ImageObject.cfc that you can use if you prefer. ImageObject.cfc even includes a revert() method allowing you to revert the image to the previous version.
CFMX and Bluedragon Compatible!
This CFC has been tested on CFMX7 for Windows, CFMX7 for Linux, and Bluedragon
6.2 JX on Linux. It has NOT yet been tested on CFMX 6.1 but *SHOULD* work.
Specifying an input file trumps passing in an image object, so don't specify both!
If you do not specify an output file, the method will return the image object in the structure key "img".
Make a Donate
If you like this open source software, and want to encourage me to continue producing and maintaining these applications, please consider making a paypal donation or buying me something off my Amazon Wish List. Your contributions are greatly appreciated!
