Imagemagick

From I Will Fear No Evil
Jump to navigation Jump to search

Various commands for ImageMagick

Convert all PNG to JPG

for x in `ls *.png` ; do convert "$x" "${x%.*}.jpg" ; done

Appending an image to another image (pulled from my wallpaper changer code

export BG_COLOR=black
export FIN_IMAGE1=random.jpg
export SPAN_SIZE_0=1024x768
convert "${FIN_IMAGE1}" -gravity "${GRAVITY_SPAN}" -background ${BG_COLOR} -resize ${SPAN_SIZE_0} -extent ${SPAN_SIZE_0} +append ${PWD}/background.jpg 

Conversion from one format to another:

convert file.png file.jpg

resize

convert file.jpg --resize 1024*768 file2.jpg