Is there any means to resize bulk images?

72 Views Asked by At

I have a load of image which has different sizes and dimentions, i have to resize every image within 500kb without loosing the aspect ratio of the each original image, resolution is not an issue. Could you suggest me a medium to do this task. Thank you.

P.S: I have to resize with respect to size of the image (within 500kb), not by dimentions or pixels

1

There are 1 best solutions below

0
Mark Setchell On BEST ANSWER

If your output images can be JPEG, you can use ImageMagick just in your Terminal. First, make an output directory, then recompress all your JPEGs, PNGs and BMPs like this:

mkdir output
magick mogrify -path output -format JPEG -define jpeg:extent=500kb *.jpg *.png *.bmp

If you are still using v6 ImageMagick, omit the word magick in the command above.


If, by "load of images", you mean thousands, use GNU Parallel:

parallel -X magick mogrify -path output -format JPEG -define jpeg:extent=500kb ::: *.jpg *.bmp *.png

If, by "load of images", you mean millions, use GNU Parallel:

find . -name "*.png" -print0 | parallel -0 -X magick mogrify -path output -format JPEG -define jpeg:extent=500kb