| By Ben Nadel | Article Rating: |
|
| July 31, 2007 08:00 PM EDT | Reads: |
29,297 |
Finally, ColdFusion 8 has incorporated image manipulation directly into the ColdFusion tag and scripting language. No more are we, as developers, chained to third-party products.
These products, while excellent in quality, just mean adding one more level of complexity to any application that requires server-side image manipulation. Now, with CFImage and an abundance of image-related functions, ColdFusion has done to image manipulation what it has done to almost every other aspect of Web applications development - it has made it simple.
Due to the wide array of image functionality in ColdFusion 8, I am going to try and break this tutorial up into several small and manageable parts. The first part will cover basic reading and writing of images using CFImage and the related image manipulation functions. But, before we get into that, let's just quickly touch upon these new features as a whole.
ColdFusion 8 has given us CFImage. CFImage provides us with tag-based access to only a small subset of the image functionality including:
- Retrieving information about an image
- Reading an image into memory
- Resizing an image
- Rotating an image
- Adding a border to an image
- Converting an image from one file format to another
- Creating a CAPTCHA image
- Writing an image to a file
- Writing an image to the browser
In addition to the CFImage tag, ColdFusion has introduced dozens of new image manipulation functions including:
- ImageAddBorder()
- ImageBlur()
- ImageClearRect()
- ImageCopy()
- ImageCrop()
- ImageDrawArc()
- ImageDrawBeveledRect()
- ImageDrawCubicCurve()
- ImageDrawLine()
- ImageDrawLines()
- ImageDrawOval()
- ImageDrawPoint()
- ImageDrawQuadraticCurve()
- ImageDrawRect()
- ImageGetEXIFTag()
- ImageGetHeight()
- ImageGetIPTCTag()
- ImageGetWidth()
- ImageGrayscale()
- ImageInfo()
- ImageNegative()
- ImageNew()
- ImageOverlay()
- ImagePaste()
- ImageRead()
- ImageReadBase64()
- ImageResize()
- ImageRotate()
- ImageRotateDrawingAxis()
- ImageScaleToFit()
- ImageSetAntialiasing()
The ColdFusion 8 CFImage tag and the image-related functions all deal with a new ColdFusion object:
coldfusion.image.Image
Most of you are not going to care about this one all that much, but for those of you who are interested in the underlying Java methods of the coldfusion.image.Image object, I have listed them below (skip past this if you have no idea what I'm talking about). Please note that any underlying methods of the actual Java/ColdFusion objects are found by gathering object metadata and through reflection; none of these methods are documented or officially supported. If you choose to use them, you do so at your own risk and discretion.
- addBorder( int, java.lang.String, java.lang.String ) - returns: void
- blur( int ) - returns: void
- brighten() - returns: void
- clearRect( int, int, int, int ) - returns: void
- copyArea( int, int, int, int ) - returns: coldfusion.image.Image
- copyArea( int, int, int, int, int, int ) - returns: coldfusion.image.Image
- crop( float, float, float, float ) - returns: void
- draw3DRect( int, int, int, int, boolean, boolean ) - returns: void
- drawArc( int, int, int, int, int, int, boolean ) - returns: void
- drawCubicCurve( double, double, double, double, double, double, double, double ) - returns: void
- drawLine( int, int, int, int ) - returns: void
- drawLines( [I, [I, boolean, boolean ) - returns: void
- drawOval( int, int, int, int, boolean ) - returns: void
- drawPoint( int, int ) - returns: void
- drawQuadraticCurve( double, double, double, double, double, double ) - returns: void
- drawRect( int, int, int, int, boolean ) - returns: void
- drawRoundRect( int, int, int, int, int, int, boolean ) - returns: void
- drawString( java.lang.String, int, int, coldfusion.runtime.Struct ) - returns: void
- flip( java.lang.String ) - returns: void
- getBase64String( java.lang.String ) - returns: java.lang.String
- getClass() - returns: java.lang.Class
- getColor( java.lang.String ) - returns: java.awt.Color
- getCurrentGraphics() - returns: java.awt.Graphics2D
- getCurrentImage() - returns: java.awt.image.BufferedImage
- getExifMetadata( javax.servlet.jsp.PageContext )- returns: coldfusion.runtime.Struct
- getExifTag( java.lang.String, javax.servlet.jsp.PageContext ) - returns: java.lang.String
- getHeight() - returns: int
- getImageBytes( java.lang.String ) - returns: [B
- getIptcMetadata( javax.servlet.jsp.PageContext ) - returns: coldfusion.runtime.Struct
- getIptcTag( java.lang.String, javax.servlet.jsp.PageContext ) - returns: java.lang.String
- getSource() - returns: java.lang.String
- getWidth() - returns: int
- grayscale() - returns: void
- info() - returns: coldfusion.runtime.Struct
- initializeMetadata( javax.servlet.jsp.PageContext ) - returns: void
- invert() - returns: void
- overlay( coldfusion.image.Image ) - returns: void
- paste( coldfusion.image.Image, int, int ) - returns: void
- readBase64( java.lang.String ) - returns: void
- resize( java.lang.String, java.lang.String, java.lang.String ) - returns: void
- resize( java.lang.String, java.lang.String, java.lang.String, double ) - returns: void
- rotate( float, float, float, java.lang.String ) - returns: void
- rotateAxis( double ) - returns: void
- rotateAxis( double, double, double ) - returns: void
- scaleToFit( int ) - returns: void
- scaleToFit( java.lang.String, java.lang.String, java.lang.String ) - returns: void
- scaleToFit( java.lang.String, java.lang.String, java.lang.String, double ) - returns: void
- setAntiAliasing( java.lang.String ) - returns: void
- setBackground( java.lang.String ) - returns: void
- setColor( java.lang.String ) - returns: void
- setDrawingStroke( coldfusion.runtime.Struct ) - returns: void
- setDrawingStroke( float, int, int, float, [F, float ) - returns: void
- setRenderingHint( java.awt.RenderingHints$Key, java.lang.Object ) - returns: void
- setTranparency( double ) - returns: void
- setXorMode( java.lang.String ) - returns: void
- sharpen( float ) - returns: void
- sharpenEdge() - returns: void
- shear( float, java.lang.String, java.lang.String ) - returns: void
- shearAxis( double, double ) - returns: void
- translate( int, int, java.lang.String ) - returns: void
- translateAxis( int, int ) - returns: void
- write( java.lang.String, float ) - returns: void
- writeBase64( java.lang.String, java.lang.String, boolean ) - returns: void
Published July 31, 2007 Reads 29,297
Copyright © 2007 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Ben Nadel
Ben Nadel has worked with ColdFusion for eight years and is a super ColdFusion enthusiast. He blogs regularly about all aspects of Web development on his personal site, http://www.bennadel.com, and does his best to give back to the ColdFusion community through online code demos and his "Ask Ben" blog posts. He is also a Certified Advanced ColdFusion MX7 developer and is one of the lead programmers at Nylon Technology.
![]() |
Michael 07/12/08 01:43:25 AM EDT | |||
The noisy ad is beyond annoying. |
||||
![]() |
Mike Ritchie 08/01/07 06:08:54 PM EDT | |||
I wonder if the CF team consulted with the developer of ImageCFC? It also was basically a wrapper for the underlying Java image functionality. Either way, this looks like an exceptionally useful tool. Do you need to instantiate the object using cfimage? Or is it possible to manipulate an image completely within cfscript? |
||||
![]() |
Sanjeev 07/15/07 10:07:34 PM EDT | |||
rename the CodFusion as ColdFusion ! |
||||
- Getting Started with Cloud Computing
- Google Sets Up Google Apps Store
- A Golden Key To The Cloud - For You!
- Day Delivers 65% License Growth for 2H 2009
- World’s Premiere Social Networking and Entertainment Phone,The Sony Ericsson Xperia™ X10 Coming To Canada Exclusively At Rogers
- Content Marketing Strategies on Ulitzer
- Loyalty Programs Dole Out Rewards but Fail to Fully Connect With Consumers Says New CMO Council Study
- links for 2010-02-04
- 2010 State of the Union Address: IDC Government Insights Sees Government Information Technology Opportunity
- Macworld 2010 Exhibitor Profiles
- Mobile Social Media Conference - Examining Social Widgets, Application Stores and Mobile Social Networking
- STOP chasing Consumers. Collaborate with your Customers.
- Getting Started with Cloud Computing
- Newspaper and Magazine Circulations Will Get Hit Hard By "New Media" Tsunami
- Google Sets Up Google Apps Store
- What Was Hot in 2009 and What Was Not?
- A Golden Key To The Cloud - For You!
- Alfresco Brings Lotus Users Open Source Content Management Platform
- Avoid the Seven Common Software Marketing Mistakes
- Day Delivers 65% License Growth for 2H 2009
- World’s Premiere Social Networking and Entertainment Phone,The Sony Ericsson Xperia™ X10 Coming To Canada Exclusively At Rogers
- Content Marketing Strategies on Ulitzer
- Why Email Deserves to Be Part of Your Marketing Strategy
- NRF Annual Convention 2010 Exhibitor Profiles
- Red Hat Named "Platinum Sponsor" of Virtualization Conference & Expo
- Drupal Content Management Platform Has Been Chosen By Ulitzer
- Drupal Creator Forms Company
- Nastel to Exhibit at SYS-CON's SOA World Conference & Expo
- Hot Banana Sponsors Gilbane White Paper On Using Web CMS
- Drupal CMS to Move to a Whole New Level
- Ulitzer’s Amazing First 30 Days in Public Beta
- Hot Banana Is First To Add Web Site Optimization, Marketing Automation To Its Web CMS
- Hot Banana Unveils Multilingual Web CMS Module
- Cloud Expo New York Call for Papers Now Open
- Ektron's CMS400.NET Now Supports Macromedia ColdFusion, Microsoft ASP, JSP, and PHP
- Magnolia 2.0 Becomes First CMS to Support the Java Content Repository
































