Project Proposal: Auto growing Layers
GNU Image Manipulation Program, or GIMP in short, is one of the most popular image editing programs that is Free and Open Source. But currently, the image layers need to be resized manually which is inefficient and degrades user experience. This can be particularly frustrating when using brush tool (ref). Also, beginners might find it hard to use. So this project aims to add support for Auto growing layers in GIMP and other features required for implementing it.
Off - canvas editing
- As off canvas editing support is in the roadmap of the project, I will write Auto growing layers feature keeping it in mind, so I will add some of the basic features required.
- Adding support for layer visibility, selection and editing outside canvas.
- Make actual boundary of layer visible by either dimming parts outside it, or displaying some kind of overlay similar to x-ray mode in blender.
- Ability to turn off off-canvas editing by having show all option.
Auto growing layers
- As the brush or part of its moves out of the bounding box of layer, the layer will be resized in that particular direction.
- This should also work while editing layer masks.
- The mask should also resize with the image.
- Internally, this will be implemented using layer boundary size option. This operation is almost instantaneous so it will not affect UX.
- There will be an option to disable this in tool settings for tools which will support this.
- Add an option in selection tools which will decide if selection should be limited by layer boundaries or not. This will work similar to current selection, i.e. we can add to selection, take union, intersection or remove from selection.
- Some tools (like foreground select tool, select by color, etc) will always select inside layer.
- If user is selecting parts outside layer and applies some operation that modifies layer, such as stroke or fill, the layer should expand to accommodate this.
- When we expand layers, position of layer w.r.t to canvas will not change.
- Using undo operation will also restore layer size to the previous point.
- Add layer attributes that will decide weather that particular layer will have resizing or not.
- Add layer attributes that can restrict automatic expansion in some direction but not others.
- Add and option which will limit on how much a layer can expand to avoid excessive memory usage. If user is exceeding this value, alert user about this.
- Add option that will decide by what amount should the layer expand when user tries to draw outside it.
- Auto resizing can cause excessive memory usage if the layer will not shrink after user erases parts of image and image can be resized to be smaller.
- Here are some points I propose to avoid "waste of memory (RAM and disk space)" as described on internship ideas page:
- Change the way layers work, converting it into the actual buffer which contains data, and the free space around which can be cropped using crop to content.
- Actual buffer data will be stored as GeglBuffer(same as now).
- Add actual size and visible size attributes to class.
- Visible size will not be stored in buffer but will be displayed as layer boundary when user selects layer.
- When using tools like erase, that cleanup some pixels, we should check if the layer can be cropped using crop to content tool, and resize actual size and GeglBuffer.