~rostiger/batchResize

A script to resize all images to multiple resolutions.
Updated default paths and colors
Small improvements
Updated comment

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~rostiger/batchResize
read/write
git@git.sr.ht:~rostiger/batchResize

You can also use your local clone with git send-email.

#Batch Resize

This script generates alternate sizes of one or more images.
It is written in bash with the purpose to supply responsive images for websites..

It is used in production with Anchors, a website built with the static site generator eleventy.

#Dependencies

To use this script you need to install imagemagick command line tools.

#Usage

Either download the script file and place it in the eleventy project root folder or clone the repository and sym link it into the eleventy project root.

Open the script and make sure that the $SRC path matches your image input path.
Check that the values in the $SIZES array match up with the preset values in your .eleventy.js configuration file.

To see what that looks like, please refer to the Anchors config file.

If everything is setup correctly, you should be able to run the script using the command ./batchResize on the command line and from within your project directory.

The script will place the size variants to /tmp/img
I recommend to .gitignore this directory.

#Rules

The script will create size variations as specified in the $SIZES array.

It skips already existing files.
If you update an image file, you need to manually delete the size variations for the script to update them..
Alternatively, you can delete the whole output folder and the script will re-create it.

The script skips sizes defined in the $SIZES array that are larger than the original image.

#License

See the License file for license rights and limitations (MIT).

#Caveat

This script was written to suit my personal purposes.

I am not a programmer and generally consider myself as someone who doesn't have a proper clue what they're actually doing.
Use this script with care and at your own risk!

And I beg you, please, always, ALWAYS make backups before you let any strangers code chew through your data!