ImageMagick

From Colettapedia
Jump to navigation Jump to search

convert

  • convert -list configure - list configuration for your install
  • -flip - horizontal mirror
  • -flop - vertical mirror
  • -crop XxY+Xoffset+Yoffset
  • -quality 25%
  • convert -delay 25 -loop 0 *.gif animation.gif - create an animated gif
  • Take the biggest internal square - convert Christopher_Coletta_headshot.jpg -set option:size '%[fx:min(w,h)]x%[fx:min(w,h)]' xc:none +swap -gravity center -composite me_headshot_square.png
  • Tile images- for i in *; do BASENAME=`basename $i _E.tif`; convert $i -crop 208x231 +repage ~/img/lymphoma-auto-color-tiled5x6/eosin/CLL/${BASENAME}_t%02d_E.tif; done
  • +repage resets the coordinate system of an image to 0,0 being in the upper left. "completely remove/reset the virtual canvas meta-data from the images"
  • -shave 2x0 - shave 4 total pixels from the width, 2 from left, 2 from right, and shave 0 pixels from top and bottom
  • -append to concat vertically and +append

Convert color phone pics to BW scanned

  • for i in $(ls *.jpg); do BASENAME=`basename $i .jpg`; echo $i $BASENAME; convert $i -enhance -enhance -depth 4 -colorspace gray -brightness-contrast 20x40 -colors 8 -rotate 90 -enhance -enhance ${BASENAME}_adjusted.pdf; done

Replace a certain background color with white

  • convert input.png -fuzz 10% -fill white -opaque "#00FF00" output.png

Tell me what color is the top left pixel

  • magick 'input.png[1x1+0+0]' -format "%[hex:p{0,0}]" info:

identify

  • also identify -verbose