I have a folder of hi-res images. It's a mix of JPG and 24-bit transparent PNG. I want to batch-generate thumbnails with the following rules:
I am new to ImageMagick and have no idea what command(s) I would need to run in order to achieve this result. Ultimately, this is for a Jekyll project, but I would happily settle for being able to run this process manually via command line.
Any help would be much appreciated!
To resize an image to specific dimensions, use the convert command with an input file, the -resize parameter, your preferred dimensions, and an output filename: convert original. png -resize 100x100 new. png.
ImageMagick command line mogrify is likely what you want and can do what you need. It processes a folder full of images. See https://imagemagick.org/Usage/basics/#mogrify and https://imagemagick.org/script/command-line-options.php#resize. The command would like be something like the following:
Create a new directory to hold your output, say, thumbnails.
Change directory to your folder with the images
mogrify -path path_to/thumbnails -resize 488x220 *
That command will process every file in your folder. If you have other formats, such as txt or other images that you do not want to process, then modify the command to restrict to just png and jpg as follows:
mogrify -path path_to/thumbnails -resize 488x220 *.png *.jpg
add *.PNG *.JPG *.jpeg *.JPEG to the end of the line
, if you have different caps and spellings for suffixes in your directory.
There are different APIs for other programming languages. See https://imagemagick.org/script/sitemap.php#program-interfaces
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With