ImageMagick 字段指南草稿
A Draft of the ImageMagick Field Guide

原始链接: https://joeldare.com/imagemagick-field-guide.html

本指南提供用于常见图像处理任务的简洁ImageMagick命令。**为网络调整大小**使用`magick input.png -resize 800x> -strip -quality 75 -interlace Plane output.jpg`优化JPEG图像——保持纵横比,移除元数据,设置压缩率,并启用渐进式加载。 **减小动画GIF文件大小**使用`magick input.gif -fuzz 7% -layers optimize output.gif`,利用颜色模糊和帧优化。**将图像组合成动画GIF**使用`magick input1.png input2.png -delay 100 -loop 5 -dispose previous output.gif`来控制帧时间,循环次数和处理方法。 最后,**垂直堆叠图像**通过`magick input1.jpg input2.jpg -append result.jpg`实现。本指南还指出ImageMagick可以直接处理来自**URL**的图像(需要适当的构建支持)。它强调使用`magick`命令,清晰的格式和一致的风格。

## ImageMagick 简明指南草稿发布 一位开发者创建了一份关于 ImageMagick 的简明“实地指南”,ImageMagick 是一款强大的图像处理工具。该指南侧重于用于常见任务(如调整大小、GIF 优化和图像堆叠)的实用命令,并对每个标志提供简要说明。 目前是初稿,作者计划扩展内容,加入关于其他常用工具(如 Git 和 Docker)的指南,最终目标是为开发者提供一系列快速参考资源。他们还打算以书籍形式出版这些指南。 该草稿提供 HTML、PDF 和 ePub 格式,网址为 [https://joeldare.com/imagemagick-field-guide.html](https://joeldare.com/imagemagick-field-guide.html),作者欢迎反馈。您还可以注册以获取未来发布的更新。
相关文章

原文
Minimark

Table of Contents

  • Resize an Image for the Web
  • Reduce Animated GIF File Size
  • Combine Multiple Images into an Animated GIF
  • Stack Images Vertically
  • ImageMagick with a URL
  • Conventions Used in This Guide

Resize an Image for the Web

magick input.png \
    -resize 800x> \
    -strip \
    -quality 75 \
    -interlace Plane \
    output.jpg

-resize 800x>

Set the width to 800px and maintain aspect ratio without upscaling smaller images. Use 800x to also upscale smaller images.

-strip

Remove EXIF, IPTC, XMP, and embedded color profiles to reduce file size.

-quality 75

Set JPEG compression to 75.

-interlace Plane

Interlace the image so that it progressively sharpens as more data arrives.

Reduce Animated GIF File Size

magick input.gif \
    -fuzz 7% \
    -layers optimize \
    output.gif

fuzz 7%

Allow a 7% color difference when comparing pixels for optimization. This helps further reduce size by treating near-identical colors as the same.

-layers optimize

Optimize the GIF animation by reducing redundant pixels between frames, which can reduce file size.

Combine Multiple Images into an Animated GIF

magick input1.png input2.png input3.png \
    -delay 100 \
    -loop 5 \
    -dispose previous \
    output.gif

-delay 100

Pause for 1 second between frames.

-loop 5

Loop the frames five times. Use -loop 0 to loop forever.

-dispose previous

Clears the previous frame before drawing the next.

Stack Images Vertically

magick input1.jpg input2.jpg input3.jpg \
    -append \
    result.jpg

-append

Stack images vertically. Use +append to stack horizontally instead.

ImageMagick With a URL

magick https://example.com/input.png \
    result.jpg

Requires ImageMagick compiled with HTTPS delegate support. Some ImageMagick builds disable remote reading.

Conventions Used in This Guide

  • Use input.png and output.jpg as the filenames (extensions can change as needed).
  • Put one switch on each line.
  • Use future tense such as "optimize" instead of "optimizes" or "optimized".
  • Use AP style heading capitalization.
  • Use the newer magick command instead of the older convert command.
  • Arbitrarily organize into what I think are the most likely use cases.

Get the Full Guide

Get the ImageMagick Field Guide when it ships, along with future guides and notes on building fast, privacy-first, evergreen sites. Subscribe below.

联系我们 contact @ memedata.com