imageflow icon indicating copy to clipboard operation
imageflow copied to clipboard

Crop doesn't work in some cases

Open FlipSs opened this issue 4 years ago • 1 comments

Hello.

Seems like crop coordinate validation doesn't work right for some images, for some reason width and height got messed up. If I try to use Region with these coordinates everything works fine.

Coordinates: x1 = 0, x2 =1632, y1 = 2322, y2 =2850. Image (2322x4128): image

Error:

 Imageflow.Bindings.ImageflowException : ArgumentInvalid: InvalidNodeParams: Crop coordinates 0,1632 2322,2850 invalid for 4128x2322 bitmap at
    imageflow_core\src\flow\nodes\clone_crop_fill_expand.rs:403:25
    https://github.com/imazen/imageflow/blob/1f6dc67eef41132d5d3300676daa5d42ae7f8941/imageflow_core\src\flow\nodes\clone_crop_fill_expand.rs#L403
    imageflow_core\src\flow\nodes\clone_crop_fill_expand.rs:436:58
    https://github.com/imazen/imageflow/blob/1f6dc67eef41132d5d3300676daa5d42ae7f8941/imageflow_core\src\flow\nodes\clone_crop_fill_expand.rs#L436
    imageflow_core\src\flow\definitions.rs:302:54
    https://github.com/imazen/imageflow/blob/1f6dc67eef41132d5d3300676daa5d42ae7f8941/imageflow_core\src\flow\definitions.rs#L302
    imageflow_core\src\flow\execution_engine.rs:294:29
    https://github.com/imazen/imageflow/blob/1f6dc67eef41132d5d3300676daa5d42ae7f8941/imageflow_core\src\flow\execution_engine.rs#L294
    imageflow_core\src\context.rs:419:59
    https://github.com/imazen/imageflow/blob/1f6dc67eef41132d5d3300676daa5d42ae7f8941/imageflow_core\src\context.rs#L419
    imageflow_core\src\context_methods.rs:50:68
    https://github.com/imazen/imageflow/blob/1f6dc67eef41132d5d3300676daa5d42ae7f8941/imageflow_core\src\context_methods.rs#L50

FlipSs avatar Jun 11 '21 08:06 FlipSs

This is likely due to rotation occurring, either as part of a instructed or optimized flip, or because the source image just uses metadata to rotate itself. Can you provide the exact code you're using to cause this so I can reproduce it later?

lilith avatar May 14 '22 20:05 lilith