Skip to content
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

Improved scaling #60

Merged
merged 2 commits into from Jul 8, 2020
Merged

Improved scaling #60

merged 2 commits into from Jul 8, 2020

Conversation

micahcantor
Copy link

This change targets the scaling done before seam carving the image. The new scaling works by:

  1. Finding the scale factor (input length / target length) for each side.
  2. Dividing the input side lengths by the smaller of these two factors to get the side lengths after scaling.
  3. Calculating the remaining pixels needed to be removed by carving by subtracting the target length from scale length.

What this will do is scale one side directly to the target length, and the other proportionally larger than the target length. As an example, if an input of 5000x2500 has a target resize of 1920x1080, it is first scaled to 2160x1080. The amount of pixels needed to be removed by carving is then 240x0.

@esimov esimov merged commit 07ee6e4 into esimov:master Jul 8, 2020
@esimov
Copy link
Owner

esimov commented Jul 8, 2020

@micahcantor it looks good to me. I've already merged it back to the master branch. Thank you for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants