user3613820
user3613820

Reputation: 21

Resizing Photos in Dir

I am somewhat new to linux. I am trying to find any jpg file in a directory structure over 10 MB. I would like to resize them from 6000x4000 to 3000x2000 which should make it less than 10MB. I would like to have the new file ".jpeg" so I can easily find them later. I can run the find command and get what I am looking for, but I cannot seem to figure out how to pipe it correctly into the magick command. Any help would be greatly appreciated.

Upvotes: 1

Views: 34

Answers (1)

Gilles Quénot
Gilles Quénot

Reputation: 185600

Like this:

find . -size +10M -name '*.jpg' -exec bash -c '
    for img; do convert -resize 3000x2000 "$img" "${img%.jpg}.jpeg"; done
' -- {} +

Upvotes: 2

Related Questions