Skip to content

Latest commit

 

History

History
45 lines (38 loc) · 1.18 KB

File metadata and controls

45 lines (38 loc) · 1.18 KB

How to resize the width of an image

magick input.png -resize 320x output.png

How to add a n-pixel-wide red border to an image

# Example of n = 4
magick input.png -bordercolor "#ff000000" -border 4 output.png

How to delete the top n pixels of an image

# Example of n = 40
magick input.png -crop +0+40 -gravity North output.png

How to convert transparency to white

magick input.png -flatten output.png

How to convert an image to grayscale

magick input.png -type grayscale output.png

How to convert a PDF to an image

magick -density 600 input.pdf -type grayscale output.png

How to merge images horizontally (side by side)

# "-gravity center" vertically center input images.
magick input1.png input2.png input3.png -gravity center +append output.png

How to split a long image into A4 PDFs

# 2480px is the width of the A4 paper size when the PPI (pixels per inch) is 300.
# 3508px is the height of the A4 paper size when the PPI (pixels per inch) is 300.
# https://imagemagick.org/script/command-line-processing.php#geometry
magick input.png -resize 2480 -crop 2480x3508 +repage output.pdf