Resize Facebook Images with ImageMagick

I would like to resize (reduce) some images the way Facebook does. ImageMagick, but hey, I'm open to suggestions :)

I believe Facebook does this:

Say you have a maximum width x height of 250x200, Facebook optimizes the use of this. Tries to use as many as 250x200. If, for example, you reduce the image and get 220x200, then they cut the top and bottom of the image until they use as much of a 250x200 frame as possible. In fact, I think that they take more from the bottom than the top (about 1: 2.5), which, I believe, is due to the fact that most of the paintings have a head at the top, and Facebook understands this.

Is there any name for such a resizing algorithm? And is there a way to get ImageMagick to do this?

Thanks in advance!

Edit In fact, it looks like Facebook might not be doing this “smart” resizing technique. They just resize when they have minwidth / minheight. Then, when they show the image in their album, they crop top / bottom or left / right to use as much as possible for the frame (that’s how I perceive it at least).

-Tobias

+3
source share
1 answer

ImageMagick , , . , Facebook, .

, , :

http://www.imagemagick.org/Usage/resize/#space_fill

, ,...

convert logo: \
      -resize 160x -resize 'x160<'   -resize 50% \
      -gravity center  -crop 80x80+0+0 +repage   space_fill_2.jpg

160 160 , 80x80.

:

http://www.google.com/search?q=image+entroy+cropping

, , .

-

Django,

edit: , .

+1

Source: https://habr.com/ru/post/1770419/


All Articles