imazen / imageflow

High-performance image manipulation for web servers. Includes imageflow_server, imageflow_tool, and libimageflow
https://docs.imageflow.io/
GNU Affero General Public License v3.0
4.17k stars 141 forks source link

Constraint mode fit_pad works incorrectly #589

Closed FlipSs closed 2 years ago

FlipSs commented 3 years ago

Hello!

Documentation says: fit_pad - Pad to desired aspect ratio, then downscale or upscale to fit If only one dimension is specified, behaves like fit.

But it does same as fit_crop

Example image: reference Example request: { "constrain": { "mode": "fit_pad", "w": 800, "h": 420, "hints": { "sharpen_percent": 15, "down_filter": "robidoux", "up_filter": "ginseng", "scaling_colorspace": "linear", "background_color": "transparent", "resample_when": "size_differs_or_sharpening_requested", "sharpen_when": "downscaling" }, "gravity": { "percentage": { "x": 50, "y": 50}}, "canvas_color": { "srgb": { "hex" : "ffffff" } } } }

Result - same as fit_crop:

result

Expected result:

0Imageflow_0