Image editing component in Flex: EditImage

by Marc

There is an update of the component.

I needed a simple image manipulation tool, similar to the one in Word. As I may want to use it in commercial products, the license is of importance. Here are the three options I found:

TransformManager

Jack Doyle has written the TransformManager component. On his blog, you also find some interesting image effects. Unfortunately, he excludes commercial use without explicit permission in his license.

ObjectHandles

Marc Hughes published ObjectHandles. It works just fine and it is under the MIT license. I might use it somewhen but the next component was just a better fit:

TransformTool

TransformTool has been hacked by Trevor McCauley and extended by Alessandro Crugnola. Trevor’s license is found in the About section and says All source files and downloads on this site are completely free to use any way you see fit for personal or commercial use. They are provided as is with no guarantee or warranty and are to be used at your own risk. I guess this allows the BSD license. Alessandro agreed by mail.

With about 80 private variables and a whopping 1’790 lines of code, TransformTool.as implements most of the functionality. I started refactoring this class at first but I haven’t finished it yet. Before we go into the details, here is the Demo and the Source see Update.

What’s new in EditImage?

  1. Cropping including constrains to size ratio
  2. Serialize the sum of the transformations so you can store and retrieve the image edits.
  3. Reset the image to the original image dimension and orientation
  4. Reset image transformations to last set state.
  5. If rotated, controls are rotated as well
  6. Rotate snaps to 0 degrees and a multiple of a defined value. It does not step through the angle with a fixed value disregarding of the starting angle like 3.456 degrees.
  7. Snap to the initial top left position.
  8. Refactored the different tools like scaling and cropping into their own package.
  9. Minimal height and width for cropping.
  10. Removed things I don’t need like registration point or skewing.
  11. It is under the BSD license.

What’s missing?

  1. This is a prototype, not a production-ready component!
  2. No single test has been written.
  3. Further clean up of code including documentation.
  4. I have not yet touched the cursors. They currently don’t work at all.
  5. Hunting some more bugs like reseting sometimes confuses the orientation of the controls.
  6. Provide user feedback when hitting limits.
About these ads