U
U
Unicom2018-01-30 18:38:43
linux
Unicom, 2018-01-30 18:38:43

Console command to select images by their resolution. How?

In general, this is the task. There are several million pictures on the disk stuffed into different folders. I want to take the whole thing in batches and squeeze it to the same quality and the same dpi.
How to do this with one picture is approximately clear:
mogrify -quality 70 -density 72
how to make a selection of pictures from all folders / subfolders, with a resolution of only up to 1024 on the larger side in one line?
It was not possible to find the necessary arguments to the find command, and it is not possible to develop the construction:
find /input/ -iname '*.jpg' -print0
it does not work.
Let me explain right away why it is necessary to make a sample with a size smaller than 1024? Because, I have already made a selection of images with a large size and brought everything to one view with the command:

find /input/ -iname '*.*' -print0 | xargs -0 mogrify -resize '1024x1024>' -quality 70 -density 72

This batch processing has already taken care of the resolution of large images, bringing everything to the same resolution and quality. Unfortunately mogrify -resize '1024x1024>' is only good for larger fetches. To find all small sizes and not change their resolution (well, not to extrapolate, really), but simply to squeeze this method is not good (seemingly).

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
SOTVM, 2018-01-30
@sotvm

after finding the images of interest (by mask location/extension/weight),
redirect | photo editing utilities/plugins, they will already read the image attributes.
is it so important for you to do it in the console?
in the graphical version it is simpler / clearer, the same xnview can handle it with a bang,
or read the mana for the console version

M
Moskus, 2018-01-30
@Moskus

Use the identifyoutput template command to create an image database (text file, via redirection), then loop through that database.

V
Victor Taran, 2018-01-31
@shambler81

how do you like this option?
s.arboreus.com/2006/11/bash.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question