Paul
Paul

Reputation: 868

Resizing images with imagemagick when they are larger than 10mb

I'm trying to resize images larger than 10 mb.

This is my imagemagick commando: convert -strip -interlace Plane -resize 70% -quality 80% file.jpg file.jpg

Can someone explain to me how i loop over the images in folder that are larger than 10mb?

Upvotes: 0

Views: 936

Answers (1)

Tom Fenech
Tom Fenech

Reputation: 74695

Use find:

find /your/path/here -name '*.jpg' -size +10M -exec convert -strip -interlace Plane -resize 70% -quality 80% {} {} \;

This finds all files larger than 10 Megabytes and with names ending in .jpg and executes the command on them. {} is a placeholder for the name of the current file.

Upvotes: 4

Related Questions