Mass recursively reducing the resolution of pictures?

Task:

Recursively to catch all the pictures and those, whose resolution is more than 1280 pixels on the longest side (72dpi), respectively, reduce up to 1280 on the longest side / 72dpi.


Parsing the Internet within a few days led to the formation of the following console commands:

find /input/ -iname "*.*" -print0 | xargs -0 mogrify -resize 1280/ -quality 70 -density 72



However, it works oddly — sometimes reduces the image in accordance with my settings, and sometimes reduces to 1280pix on the smaller side. The patterns could not be detected.


Tell me where I went wrong or what the console command is better to use for my task?
October 3rd 19 at 03:55
2 answers
October 3rd 19 at 03:57
Your resize reduce to 1280 in width, height does not take into account at all. Need -resize '1280x1280>'
www.imagemagick.org/www/command-line-processing.html#geometry
Yes, thank you, at first glance, works as it should. And for a reference, too, and a man gives well very scanty info. - hillary_Leffl commented on October 3rd 19 at 04:00
Discovered a strange thing: at the end of the command videat error
mogrify: unable to open image `50': @ error/blob.c/OpenBlob/2489.
It turned out that "70" is the value of the parameter "— quality 70". Can't understand why it is interpreted. And apparently the value -quality is not mapped, because even a compressed image is too heavy (and not supposed to be like that when quality 70). - hillary_Leffl commented on October 3rd 19 at 04:03
Wrong, this is correct, error: mogrify: unable to open image `70': @ error/blob.c/OpenBlob/2489. - hillary_Leffl commented on October 3rd 19 at 04:06
October 3rd 19 at 03:59
Is 1280 try/ use 1280x1280:

find /input/ -iname "*.*" -exec convert {} -resize 1280x1280 -quality 70 -density 72 {} \;
Thanks, but I prefer mogrify, because the original file I don't need. Tell me what your design is different from mine (except the convert/mogrify)? And that gives the end {} \;? - hillary_Leffl commented on October 3rd 19 at 04:02
Yes, I have something to convert out of habit wrote. in fact convert the filename... the filename is no different from mogrify.
"{} \; " is used with -exec to find'e. instead of the {} substitutes the file name and the \; indicates the end of the command.
again, I have a habit instead of find | xargs, use find-exec. - hillary_Leffl commented on October 3rd 19 at 04:05

Find more questions by tags DebianImagesImageMagick