The next episode
Darkroom library has been discontinued and is no longer maintained. If you're looking for an alternative, backed with a strong dev team, you should have a look at Doka Image Editor.
Features: Enforce crop aspect ratio. Fast image uploads. Rotate, resize and flip. Overlay crop guides. Photo filter effects. Responsive and accessible.
The library is designed to be easily extendable. The core script only transforms the target image to a canvas with a FabricJS instance, and creates an empty toolbar. All the features are then implemented in separate plugins.
Each plugin is responsible for creating its own functionality. Buttons can easily be added to the toolbar and binded with those features.
Currently, the implemented features are:
- Crops the image by selecting a zone with your mouse. This supports several options like ratio and dimensions control (min/max).
- Adds two buttons to let you rotate hte image to the left or the right.
- Allows to undo and redo any changes on the main image.
- Transform back the canvas into image. This is mainly a proof of concept to show how plugins work. This one only makes a few lines.
The project is under MIT license. Feel free to fork the project on GitHub or report issues. All ideas are also welcome.