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.
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.
Share Improve this question edited Feb 4 at 2:39 Gilles Quénot 186k43 gold badges231 silver badges229 bronze badges asked Feb 4 at 1:16 user3613820user3613820 211 bronze badge 2 |1 Answer
Reset to default 2Like this:
find . -size +10M -name '*.jpg' -exec bash -c '
for img; do convert -resize 3000x2000 "$img" "${img%.jpg}.jpeg"; done
' -- {} +
convert
options for this. Then, storage is cheap... – xenoid Commented Feb 4 at 10:45-define jpeg:extent
like this stackoverflow/a/64411598/2836621 – Mark Setchell Commented Feb 8 at 8:58