Diewuxi

Belive tomorrow will be better, love science and technology, support communication and understanding, always ready for thought turn.

Blog / engineering_technology / computer / software / media / graphic / ImageMagic 笔记

Blog


Article^ Parent

ImageMagic 笔记


Date: 2023-02-06 00:00:00
Description: ImageMagic 使用笔记。
Keywords: ImageMagic, 图片处理
Category: engineering_technology/computer/software/media/graphic
Tag: imagemagic, graphic
Link: https://www.diewuxi.com/blog/article/89.html

Changelog

* 2023-02-06
    * Done
                        

convert

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
                        

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
                        

format

convert input.bmp output.jpg
convert input.bmp -quality 95 output.jpg
                        

rotate

convert input.jpg -rotate 90 input-rotated.jpg
                        

change density

convert -units PixelsPerInch input.jpg -density 300x300 output.jpg
convert -units PixelsPerInch input.jpg -density 300 output.jpg
                        

Watermark

montage

montage input1.jpg input2.jpg input3.jpg input4.jpg input5.jpg -tile 3x2 -geometry "64x64>+2+2" montage.jpg
                        

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

Comments [1]

  • Hilda Ansell[1#]
    Hi diewuxi.com owner, Thanks for sharing your thoughts!
    2024-08-30 07:13:07Reply

Write comment(* is necessary, and email is not shown to public)


Diewuxi 2017--2024