Darkland | net

ImageMagick Notes

Published on 11 January, 2018 by Amanda
Updated - 14 September, 2020 -- Amanda

Resize multiple image files in a directory to specific dimensions using find: find ./ -maxdepth 1 -type f -exec convert -scale 1280x960 {} {} \; -maxdepth limits find to the current directory and prevents it from descending in to any subdirectories.

Remove metadata from image file: convert -strip [target] [destination]
Create a new image with a border and caption: convert ./20200621\ -\ Priscila\ Benicio.jpg -type TrueColor -resize 90% -bordercolor Black -border 5% -pointsize 32 -fill "#6699ff" -draw "text 410,40 '\"Move Yourself ♥👊\"'" -draw "text 315,1050 '21.06.2020 - Priscila Benicio'" ./20200621\ -\ Priscila-006.jpg
Create a contact sheet--montage calls this a composite image--from multiple jpegs or pngs in a directory: montage -verbose -label %f -tile 5x4 -background "#000000" -fill "white" -define jpeg:size=240x180 -geometry 240x180 -auto-orient ./*.jpg -title "Dana Scully Has Never Been A Vegan" contact.jpg This example operates on jpegs, but any image file extension can be used. Be careful if operating on animated gifs. montage will dissasemble them and create a contact sheet of individual frames.
Also, any transparent pixels in the animated gif will be converted to the defined background color for the contact sheet. The animated gif must be converted from an "overlay animation" into a "coalesced animation" to prevent this. --(Reference:https://stackoverflow.com/questions/13317825/imagemagick-leaves-artifacts-in-gif-to-jpg-list-conversion#13317877)
Back