Skip to content

Improved scaling - #60

Merged
esimov merged 2 commits into
esimov:masterfrom
micahcantor:improved_scaling
Jul 8, 2020
Merged

esimov merged 2 commits into
esimov:masterfrom
micahcantor:improved_scaling

Conversation

@micahcantor

Copy link
Copy Markdown

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

esimov commented Jul 8, 2020

Copy link
Copy Markdown
Owner

@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.

2 participants