-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Framing Tool #7253
base: dev
Are you sure you want to change the base?
Add Framing Tool #7253
Conversation
Thank you very much for working on this! I briefly tried the framing feature. I have some feedback for you to consider while I continue testing.
|
I shared this pull request in the forum because I think it deserves exposure (no pun intended). https://discuss.pixls.us/t/border-framing-tool-in-development/46636 |
* Added under the Resize tool like PR sharpening * Adds FramingParams and FramingParamsEdited structs * No parameter read/write implemented * No support for batch mode * No adjuster listeners implemented * Signals and callback functions are defined but do nothing
* Added for ToolPanel listener and Adjuster * Follows style of ConnectionBlocker for sigc::connection
* Adds FramingParams parameter struct to ProcParams * Implement saving and writing to struct from framing tool GUI
* Implement writing FramingParams to keyfile * Implement reading FramingParams from keyfile
* Implements edited param manipulation operations for framing tool
* Update partial profile load/save GUI to include framing tool * Allows for loading/saving framing tool parameters from the clipboard
* Add new events to ProcEvents * Add new events to refresh map under RESIZE category * Add new strings for displaying events in history panel * Hook up GUI events with emitting ProcEvents
* Set sensitivity of aspect ratio and orientation combo boxes * Sensitivity determined by absolute/relative sizing method * Show allow upscaling box for BBOX framing method
* Refactor simpleprocess.cc to be more clear on resize dimensions * Implement image and frame sizing calculations * Resizes the image based on adjusted framing calculations * Missing functionality to draw border around image after resizing
* Draws border after all resize operations are complete * Update the RGB sliders for 16-bit channels
* Add adjuster add/set options to preferences * Update width/height limits * Trim adjuster values * Batch mode fixes * Display all settings with sensitivity * Add "(Unchanged)" option to combo boxes * Fix checked button toggle modes
* Compute image aspect ratio if required instead of leaving at 0 * Fix divide by zero error in computing framed size * Compute resize scale based on original crop * Reword "Current" aspect ratio to "As Image"
* Rename "Resize" to "Resize & Framing" from discoverability * Add ColorPreview class for displaying a solid color * Add border color preview
Nice! Let me review. |
The fixes and improvements are working as expected. There are a few more issues I found, listed here with the associated test case:
Regarding the color, the indicator works fine if the output and display profiles are sRGB. It will need to be more sophisticated to handle other profiles. I can help with that. |
* Fix incorrect uniform relative border size calculation * Fix minimum size requirements not being respected * Drive-by code formatting changes
Thanks for testing! I've fixed all 6 issues. To make testing a little less click intensive, I've uploaded some partial There is a utility bash script that runs them all. Please read the script for how to use/internet safety. I'll do some more testing over the week. |
Framing Tool
Adds a framing/borders tool under the resize tool. Lightroom and darktable have similar functionality.
Plenty of people share images on platforms like Instagram. The platforms restrict image sizes and aspect ratios. This features allows you to keep your image's aspect ratio by adding a simple colored border. Users can have the tool downscale their images to fit within certain dimensions. This way the user can use RawTherapee's resizing method and post-resize sharpening tools rather than relying on the platform's algorithms.
The standard framing method can be used to add buffer areas for full-bleed printing (#6791).
It's easier to do batch processing for regular users when you don't need to use Gimp scripting or ImageMagick to add borders on multiple images.
UI
Processing Pipeline Changes
Framing resize operation does not perform resizing on an already resized image. Instead, if needed, the initial resize parameters are adjusted before performing the actual resize.
Post-resize sharpening will apply to the framing resized image. The border will not be in the image data yet, so sharpening will not be affected by the framing tool.
The borders are drawn after the image is in the output colorspace (i.e. after
lab2RgbOut()
).User Documentation
The framing tool adds a variable-sized border to your output image. It works in tandem with the Resize tool to downscale/upscale your image. Post-resize sharpening may be applied to the image as well.
Tool Settings
Method
Aspect Ratio
Specify the aspect ratio of the frame in Standard and Bounding Box framing methods. If the border sizing constraint is too small to meet the aspect ratio (i.e image would be cut off), then the minimum borders needed to meet the aspect ratio is used. The aspect ratio of the post-Resize tool image can be used by selecting the "As Image" option.
Orientation
Specify the orientation of the frame aspect ratio. The orientation of the post-Resize tool image can be used by selecting the "As Image" option.
Framed Width/Height
Specify the bounding box of the frame in pixels for the Bounding Box framing method. Specify the fixed frame dimensions in pixels for the Fixed Frame method.
Allow Upscaling to Frame
In the Fixed Frame and Bounding Box framing methods, if the image is smaller than the maximum allowed size, upscale the image to its max size.
Sizing Method
Determines how the size of the border is calculated. The border sizing values refer to the size on one side of the image. For example, a 10px border will add 20px the the total height of your image after framing.
Relative
Specify the border size based on a percentage of the chosen.
Basis
If the basis side border is too small for the requested aspect ratio, the minimum possible value will be used.
Limit Minimum Size
If enabled, ensures a minimum border size for horizontal/vertical borders as specified by the Minimum Width/Height inputs.
Uniform Relative
Adds a uniform border that is the same size horizontally and vertically. The border size is determined based on the image size as in the Relative sizing method. The minimum width and height are automatically updated to match each other.
Absolute
Specify the fixed border size in pixels using the Border Width/Height inputs. The aspect ratio and orientation options are ignored in this mode.
Border Color
Choose the 16-bit RGB values of the border.
Limitations
Example Output
Framing Method: Standard
Sizing: Relative @ Auto 10%
Crop Dimensions: 4800x3840
Resize Dimensions: 4800x3840
Adjusted Dimensions: 4800x3840
Output Dimensions: 5760x4608
Framing Method: Standard
Sizing: Relative @ Auto 10%
Crop Dimensions: 4800x3840
Resize Dimensions: 500x400
Adjusted Dimensions: 500x400
Output Dimensions: 600x480
Framing Method: Standard (4:5 Portrait)
Sizing: Relative @ Height 10%
Crop Dimensions: 4800x3840
Resize Dimensions: 500x400
Adjusted Dimensions: 500x400
Output Dimensions: 500x625
Framing Method: Standard (4:5 Portrait)
Sizing: Relative @ Height 10%
Min Size: W=200 H=100
Crop Dimensions: 4800x3840
Resize Dimensions: 500x400
Adjusted Dimensions: 500x400
Output Dimensions: 900x1125
Framing Method: Standard
Sizing: Absolute @ W=100 H=200
Crop Dimensions: 4800x3840
Resize Dimensions: 500x400
Adjusted Dimensions: 500x400
Output Dimensions: 700x800
Framing Method: Fixed Frame (400x500)
Sizing: Relative @ Auto 10%
Crop Dimensions: 4800x3840
Resize Dimensions: 500x400
Adjusted Dimensions: 333x267
Output Dimensions: 400x500
Framing Method: Bounding Box (500x400) (4:5 Portrait)
Sizing: Relative @ Auto 10%
Crop Dimensions: 4800x3840
Resize Dimensions: 500x400
Adjusted Dimensions: 267x213
Output Dimensions: 320x400
Framing Method: Bounding Box (800x1000) (4:5 Landscape)
Sizing: Relative @ Auto 10%
Crop Dimensions: 4800x3840
Resize Dimensions: 500x400
Adjusted Dimensions: 500x400
Output Dimensions: 600x480
Framing Method: Bounding Box (800x1000) (4:5 Landscape)
Sizing: Relative @ Auto 10%
Allow Upscaling To Frame: Yes
Crop Dimensions: 4800x3840
Resize Dimensions: 500x400
Adjusted Dimensions: 667x533
Output Dimensions: 800x640
Framing Method: Fixed Frame (80x100)
Sizing: Absolute @ W=100 H=200
Crop Dimensions: 4800x3840
Resize Dimensions: 500x400
Adjusted Dimensions: 40x32
Output Dimensions: 80x100