Answer the question
In order to leave comments, you need to log in
ImageMagik - how to make square images?
How to use mogrify to make all images square, and if they are large, then reduce them to 1000x1000 pixels? (and if they are smaller, then do not increase)
Now I do this: mogrify -geometry 1000x1000 -background white -extent 1000x1000 -gravity center *
In this case, small pictures are stretched to 1000x1000.
I would also like to process both jpg and png in one run, but in png you need to preserve transparency, and in jpg make the fill white. If you specify -background none, then in png everything is fine, but in jpg it fills with black.
Answer the question
In order to leave comments, you need to log in
In general, I would do it through convert -resize
. Accordingly, y -geometry
has suffixes < and > used in the form 1000x1000>
, for example. This tells IM "don't increase anything less". Options are described here www.imagemagick.org/script/command-line-processing...
And you forgot -background white
to add -compose Copy
.
The complete code will look like this (some OSes will require you to escape the character >
):
It is worth doing in two passes for PNG and JPEG separately, adding settings to the command for JPEG -quality
and -sampling-factor
- there is nothing wrong with that. Don't forget, also, -strip
to optimize if required.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question