Difference between revisions of "ImageMagick"

From Indie IT Wiki
imported>Plittlefield
 
Line 32: Line 32:
  
 
  convert FlexGet_NEW.png -resize 72x72^ FlexGet_NEWER.png
 
  convert FlexGet_NEW.png -resize 72x72^ FlexGet_NEWER.png
 +
 +
== HOWTO: Change Format ==
 +
 +
Single file ...
 +
 +
convert -quality 50 -format webp myimage.jpg
 +
 +
All files in a folder ...
 +
 +
mogrify -quality 50 -format webp *.jpg
  
 
== HOWTO: Identify ==
 
== HOWTO: Identify ==

Revision as of 15:18, 25 November 2022

HOWTO: Watermarking

#!/bin/bash

# Initialize variables
WM=/path/to/watermark.png
SCALE=50

# Find all image files in current directory and watermark
file -i * | grep image | awk -F':' '{ print $1 }' | while read IMAGE
  do
    echo Watermarking $IMAGE
    NAME=`echo $IMAGE | cut -f1 -d.`
    EXT=`echo $IMAGE | cut -f2 -d.`
    composite -dissolve 50% -gravity center -quality 100 \( $WM -resize $SCALE% \) "$IMAGE" "${NAME}_wm.${EXT}"
  done
exit 0

HOWTO: Resize And Change Quality

convert cover_big.jpg -resize 500x500 -quality 70 cover.jpg

HOWTO: Crop And Resize To 500x500

convert old.jpg -resize 500x500^ -gravity center -crop 500x500+0+0 +repage new.jpg

HOWTO: Crop

convert old.jpg -crop 67x67+130+0 +repage new.jpg

HOWTO: Resize

convert FlexGet_NEW.png -resize 72x72^ FlexGet_NEWER.png

HOWTO: Change Format

Single file ...

convert -quality 50 -format webp myimage.jpg

All files in a folder ...

mogrify -quality 50 -format webp *.jpg

HOWTO: Identify

identify FlexGet_NEWER.png

HOWTO: Display

display FlexGet_NEWER.png

Information

http://www.imagemagick.org