I created this example after reading a job posting looking for the ability to first load an image, and then, by selecting a portion of the image (using a selection rectangle), to save it into a "OCR-like" TIF file.
Click to try the example.
Sceenshot of the app:
If you're a regular reader of my blog, you'll recognize my technique that combines an AS3 PNG encoder, an open-source utility (KVEC), the Apache Batik project, and of course, ColdFusion 9, enabling you to convert an image to the TIF/PNG/SVG/PDF formats.
This example allows you to upload any JPG, PNG, or GIF (up to 500 KB each upload), and convert it entirely (or select any portion of it with a ActionScript 3 selection rectangle) to all four file-types - a SVG, a PNG, a TIF, and a PDF. It works like this:
-
The uploaded image (or only a selected portion) is passed as binary data to a ColdFusion CFC function that saves a PNG to the ColdFusion server's file system.
-
Next, leveraging an open source tool, KVEC, the PNG, created in step one, is passed to another CFC function that converts the PNG to a SVG file.
-
Next, the SVG is passed to a CFC function that completes the final conversions -
1) to a PDF file and 2) to a TIF file, using the Apache Batik project's batik-rasterizer.jar.
-
Next, leveraging the ColdFusion 9 (available in CF 8 too) <cfzip> tag, a CFC function creates a zip archive containing the PNG, the SVG, the TIF, and the PDF files of the uploaded image.
-
Finally, to save on disk space, a final CFC function is called to delete the TIF, SVG, and PDF files (once the zip archive is safely created). The PNG is retained and used for display purposes.
Click to try the example.
Tip Jar:
|