====== ImageMagick ======
===== Usage =====
==== Screenshots ====
I use this script for taking screenshots, bound to the ''Print Scrn'' key with [[i3wm]]. It dumps a screenshot into my 'Pictures' directory, and makes a beep. You can set it to make a notification if you want.
#!/bin/bash
import -window root $HOME/Pictures/screenshot_`date +%y-%m-%d_%H-%M-%S`.png
Without beep:
#!/bin/bash
import -silent -window root $HOME/Pictures/screenshot_`date +%y-%m-%d_%H-%M-%S`.png
==== Image Conversion ====
Two main commands are ''convert'' and ''mogrify''. The distinction is that the former makes new files, and the later can overwrite existing files.
This will convert all PNGs in the current directory to JPGs at quality 50 and scaled to 1200px width.
mogrify -format jpg -quality 50% -resize 1200x *.png
==== Create PDF ====
To create a PDF from a bunch of PNG files in a directory:
convert *.png [name].pdf
===== Guides =====
* [[https://web.archive.org/web/20210211224638/http://www.ibm.com/developerworks/library/l-graf/?ca=dnt-428|Graphics from the command line]] - Archive of 2003 guide by Michael Still.
* [[https://web.archive.org/web/20200320002320/https://www.ibm.com/developerworks/library/l-graf2/?ca=dgr-lnxw15GraphicsLine|More graphics from the command line]] - Archive of 2004 guide by Michael Still.
* [[https://legacy.imagemagick.org/Usage/|Examples of ImageMagick Usage (Legacy Version 6)]]
* [[https://legacy.imagemagick.org/Usage/crop/#crop_spaced|§Separating Spaced-out Tiling Images]]
* [[https://legacy.imagemagick.org/Usage/crop/#crop_equal|§Cropping into roughly Equally Sized Divisions]]
* [[https://legacy.imagemagick.org/discourse-server/viewtopic.php?t=28906|sprite sheets to animated .gif files]] - forum thread.
* [[https://stackoverflow.com/questions/56040013/convert-sprite-sheet-to-gif-animation|Convert sprite sheet to gif animation]] - Stackoverflow, 2019.
* [[http://www.fmwconcepts.com/imagemagick/index.php|Fred's ImageMagick Scripts]]
*
===== See Also =====
* [[https://imagemagick.org/|imagemagick.org]]
* [[github>imagemagick/imagemagick]]
* [[wp>ImageMagick]]
* [[gmt>ImageMagick]]
{{tag>cli guide software}}