ImageMagic 笔记
Date: | 2023-02-06 00:00:00 |
Description: | ImageMagic 使用笔记。 |
Keywords: | ImageMagic, 图片处理 |
Tag: | imagemagic, graphic |
Link: | https://www.diewuxi.com/blog/article/89.html |
Table of contents
^ 1 Changelog
* 2023-02-06
* Done
^ 2 convert
^ 2.1 draw
convert -stroke yellow -strokewidth 5 -draw "line 500,300 800,300" \
-strokewidth 1 -pointsize 12 -draw "text 500,400 '10 um'" \
draw_ellipse.gif \
draw_ellipse-bar.gif
^ 2.2 resize
ImageMagick will try to preserve the aspect ratio if you use this command. It will alter the image to fit within a 200×100 area, but the image may not be exactly 200×100. If you want to force the image to become a specific size – even if it messes up the aspect ratio – add an exclamation point to the dimensions:
convert input.jpg -resize 640x320! output.jpg
convert input.jpg -resize 640x320 output.jpg
convert input.jpg -resize 640 output.jpg
convert input.jpg -resize x320 output.jpg
^ 2.3 format
convert input.bmp output.jpg
convert input.bmp -quality 95 output.jpg
^ 2.4 rotate
convert input.jpg -rotate 90 input-rotated.jpg
^ 2.5 change density
convert -units PixelsPerInch input.jpg -density 300x300 output.jpg
convert -units PixelsPerInch input.jpg -density 300 output.jpg
^ 2.6 Watermark
^ 3 montage
montage input1.jpg input2.jpg input3.jpg input4.jpg input5.jpg -tile 3x2 -geometry "64x64>+2+2" montage.jpg
^ 4 identify
identify -units PixelsPerInch -format "Size: %w pixels x %h pixels\nDensity: %x ppi x %y ppi\n" mypic.jpg
Last modified: 2023-02-06
Viewed (65)
Liked (0)
Comments [1]
-
Hi diewuxi.com owner, Thanks for sharing your thoughts!2024-08-30 07:13:07Reply
Add comment(* is necessary, and email is not shown to public)