Image editing component in Flex: EditImage
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:
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.
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?
- Cropping including constrains to size ratio
- Serialize the sum of the transformations so you can store and retrieve the image edits.
- Reset the image to the original image dimension and orientation
- Reset image transformations to last set state.
- If rotated, controls are rotated as well
- 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.
- Snap to the initial top left position.
- Refactored the different tools like scaling and cropping into their own package.
- Minimal height and width for cropping.
- Removed things I don’t need like registration point or skewing.
- It is under the BSD license.
- This is a prototype, not a production-ready component!
- No single test has been written.
- Further clean up of code including documentation.
- I have not yet touched the cursors. They currently don’t work at all.
- Hunting some more bugs like reseting sometimes confuses the orientation of the controls.
- Provide user feedback when hitting limits.