0

I would like to loop through some directories with pictures and copy (and after reviewing remove) them to another directory based on image dimensions, let's say smaller than 800x600.

I've tried a query like

find . -iname "*.jpg" -type f -exec identify -format '%w %h %i' '{}' \; | awk '$1<800 || $2<600 

but I get no results, but I'm certain that there are smaller pictures.

Can anyone give me a hint? Thanks!

5
  • superuser.com/q/1513618/432690 Commented Mar 10, 2020 at 12:28
  • Possibly related shell command to get pixel size of an image Commented Mar 10, 2020 at 12:35
  • What happens if you change the format string to '%w %h %i\n'? I think your entire output may get concatenated to one single line at the moment because the format doesn't specify that a new-line is to be printed at end-of-record, and if the very first picture found doesn't happen to be smaller than 800x600, the entire output will be discarded by awk. Commented Mar 10, 2020 at 13:00
  • Also, shouldn't it be awk '$1<800 && $2<600'? Commented Mar 10, 2020 at 13:02
  • 1
    Does this answer your question? Use mogrify to resize large files while ignoring small ones Commented Mar 10, 2020 at 18:09

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.