Imagemagick Back

1. Install

  • System version: Ubuntu 14.04
  • Update local package
sudo apt-get upgrade
  • Install the software
sudo apt-get install imagemagick

2. Usage

2.1 generate perspective image

  • to generate images from 4 differents points(A, B, C, D)
convert input.png -matte -virtual-pixel transparent\
-distort Perspective\
'from[A].x, from[A] to[A].x, to[B].y\
 from[B].x, from[B] to[B].x, to[B].y\
 from[C].x, from[C] to[C].x, to[C].y\
 from[D].x, from[D] to[D].x, to[D].y' output.png
  • example:

2.2 create a complete transparent image

convert -size "[w]x[h]" xc:"rgba(0,0,0,0)" PNG32:output.png

2.3 add padding to a png file

convert "input.png" -background transparent -gravity center -extent "[w]x[h]" output.png

2.4 get width and heigh of an image

identify -format "{\"width\": %[fx:w], \"height\": %[fx:h]}" input.png

2.5 genereate image with text

convert -size [width]x[height]\
    -font "msyh.ttf"\
    -pointsize 16\
    -fill "#000000"\
    -background transparent\
    -gravity center\
    caption:"这是一串字符串" text.png
Empty Comments
Sign in GitHub

As the plugin is integrated with a code management system like GitLab or GitHub, you may have to auth with your account before leaving comments around this article.

Notice: This plugin has used Cookie to store your token with an expiration.