ImageMagick
ImageMagick / Image Magick
Increase gamma for all jpgs in ths folder
mogrify -gamma 1.45 $(find -name \*.jpg)
Join images on top of each other
composite -gravity SouthEast -geometry +20+20 hinzu.jpg quelle.jpg ergebnis.jpg Options: -gravity [NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast] -geometry [width]x[height][+/-xoffset][+/-yoffset]
Join images besides each other, aligned in a row
convert a.png b.png +append joined.png
Convert
convert creates a new image while mogrify replaces the original
convert -size 120x120 cockatoo.jpg -resize 120x120 +profile "*" thumbnail.jpg
- '-size 120x120' gives a hint to the JPEG decoder that the image is going to be
downscaled to 120x120, allowing it to run faster by avoiding returning full-resolution images to ImageMagick for the subsequent resizing operation.
- '-resize 120x120' specifies the desired dimensions of the output image.
It will be scaled so its largest dimension is 120 pixels.
- '+profile "*"' removes any ICM, EXIF, IPTC, or other profiles that might
be present in the input and aren't needed in the thumbnail.
To convert a directory full of JPEG images to thumbnails, use:
mogrify -size 120x120 -resize 120x120 *.jpg +profile "*" 123x456 123x 123x456! exact this values 123x456> only if greater
add a textbox under the image
convert xc:white -resize 1xHEIGHT! BLANK convert -append INFILE BLANK TMPFILE convert TMPFILE -gravity "South" -family FAMILY -pointsize FONTSIZE -draw "text 0,3 'This text is added to the picture'" OUTFILE
transparent color on existing file
mogrify -transparent white <FILE.png>
make a negative:
mogrify -negate <FILE.png>
Rotate and mirror images
- -flip = waagerecht
- -flop = senkrecht
- -transpose = diagonal (linksoben-rechtsunten)
- -transverse = diagonal (rechtsoben-linksunten)
Trim
mogrify -trim mogrify -trim +repage QD-vs-NC.png convert $old -trim +repage -colorspace Gray -type GrayScale $new
PDF -> jpg
convert -density 150 a.pdf a-%d.jpg convert a.pdf -colorspace Gray -type GrayScale a-%d.jpg
JPEG Compression
convert -quality 85 a.png a.jpg
Draw
convert FILE -draw "rectangle 0,0 100,100" OUTFILE
convert FILE -gravity "Center" -family FAMILY -pointsize FONTSIZE -draw "text 0,3 'This text is added to the picture'" OUTFILE
FAMILY: times,arial,serif,courier,...
- perl function to paint a black frame around an image
sub draw_frame { my $file = shift; my $width = shift; my $height= shift; my $thickness = shift; $_ = "convert $file ". "-draw \"rectangle 0,0 ".($width-1).", ".($thickness-1)."\" ". "-draw \"rectangle 0,0 ".($thickness-1)." ,".($height-1)."\" ". "-draw \"rectangle ".($width-1).",0 ".($width-$thickness).",".($height-1)."\" ". "-draw \"rectangle 0,$height $width,".($height-$thickness)."\" ". $file; system($_); }