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

Keep the aspect ratio through ImageOps.fit #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Keep the aspect ratio through ImageOps.fit #3

wants to merge 2 commits into from

Conversation

milot-mirdita
Copy link

With the use of ImageOps.fit the aspect ratio of the picture isn't distorted. This cuts off (in a pretty dumb way) that is outside of the center.
A better approach might be something based on image entropy to cut out "uninteresting" parts of the images. Reddit uses a setup similar to this to make good thumbnails.

With the use of ImageOps.fit the aspect ratio of the picture isn't distorted. This cuts off (in a pretty dumb way) that is outside of the center.
A better approach might be something based on image entropy to cut out "uninteresting" parts of the images. Reddit uses a setup similar to this to make good thumbnails.
@ranman
Copy link

ranman commented Aug 4, 2012

You can also do this:

imgsize = 900, 900
img.thumbnail(imgsize, Image.ANTIALIAS)

Which will preserve the aspect ratio intelligently.

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