Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Crop overscan in Extract Review #1569

Merged
merged 15 commits into from
May 27, 2021
Merged

Conversation

iLLiCiTiT
Copy link
Member

@iLLiCiTiT iLLiCiTiT commented May 24, 2021

Description

  • added ability to define Overscan Crop for input in ExtractReview plugin
  • input field is string where is possible to define how crop will work
    • value may cause that resolution will be expanded instead of cropped
    • crop may be explicit or relative, in pixels or percents
    • added special percent case -10%+ (10 is random number) which says that input resoltuion is 110% of expected output (input width 2200px -> output width 2000px)
    • value may containt 2 values one for width second for height
    • all values are center related == +300px will add 150px on both sides and keep center in center
    • filters should only crop or expand resolution (not rescale)

Example variants with description

String Output Description
2200px Empty string keep resolution unchanged.
50% 1100px Crop 25% of input width on left and right side.
300px 300px Keep 300px in center of input and crop rest on left and right.
300 300px Values without units are used as pixels (px).
0px 0px Invalid value.
+0px 2200px Keep resolution unchanged.
+300px 2500px Add black pillars of 150px width on left and right side.
-300px 1900px Crop 150px on left and right side
+10% 2420px Add black pillars of 5% size of input on left and right side.
-10% 1980px Crop 5% of input size by on left and right side.
-10%+ 2000px Input width is 110% of output width.

Closes https://github.com/pypeclub/client/issues/53#issuecomment-846796817

@iLLiCiTiT iLLiCiTiT self-assigned this May 24, 2021
@iLLiCiTiT iLLiCiTiT added the type: enhancement Enhancements to existing functionality label May 24, 2021
@iLLiCiTiT iLLiCiTiT marked this pull request as ready for review May 24, 2021 14:19
@mkolar
Copy link
Member

mkolar commented May 25, 2021

Syntax for reversing the overscan using -10%+ us not working. Instead it actually expands the result by 10% while keeping the same resolution.

Copy link
Member

@mkolar mkolar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment about the -+ syntax.

Secondly Please move the crop settings above the resolution. They are processed in order, it would be good to set them in order too.

Lastly, can we make 0 value do nothing instead of being invalid? Same as with resolution if the setting is 0 or empty it should be considered the same - disabled

string_value = re.sub(r"([ ]+)?px", " ", string_value)
string_value = re.sub(r"([ ]+)%", "%", string_value)
# Make sure +/- sign at the beggining of string is next to number
string_value = re.sub(r"^([\+\-])[ ]+", "\g<1>", string_value)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

invalid escape sequence '\g'

@iLLiCiTiT
Copy link
Member Author

see comment about the -+ syntax.

Swapped +/- in code. Fixed.

Secondly Please move the crop settings above the resolution

Done

Lastly, can we make 0 value do nothing instead of being invalid?

Done. Additional question, what if output is smaller than 0px? (Small chance but possible...)

@iLLiCiTiT iLLiCiTiT requested a review from mkolar May 26, 2021 11:35
@mkolar mkolar merged commit 9040817 into develop May 27, 2021
@mkolar mkolar deleted the feature/crop_overscan_extract_review branch May 27, 2021 19:01
@mkolar mkolar added this to the 3.0.0 milestone May 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement Enhancements to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants