Files
oam/knowledge base/imagemagick.md
2023-07-09 14:49:46 +02:00

2.1 KiB

ImageMagick

Components:

  • compare: diff tool
  • convert: image conversion tool

Table of contents

  1. TL;DR
  2. Further readings
  3. Sources

TL;DR

# Scale images to 50% its original size.
magick convert -adaptive-resize '50%' 'in.jpg' 'out.jpg'

# Create GIFs from single images.
magick *.jpg 'out.gif'

# Convert N images into individual PDF documents.
magick *.jpg +adjoin 'page-%d.pdf'

# Convert N images into pages of a single PDF document.
magick *.png 'out.pdf'

# Calculate the percentage of *similarity* between 2 images.
# Avoid saving the diff.
magick compare -metric 'NCC' 'in_1.jpg' 'in_2.jpg' NULL:

# Output only the differences between 2 images.
magick compare -compose 'src' -fuzz '5%' 'in_1.jpg' 'in_2.jpg' 'diff.jpg'

Further readings

Sources

All the references in the further readings section, plus the following: