ImageMagick / Usage-Markdown

Base text document processed with pandoc
12 stars 13 forks source link

Usage Tip: Specify a Canvas as a Single Argument #18

Open emcconville opened 9 years ago

emcconville commented 9 years ago

from http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=28153

Update canvas usage page with the following content.

Many times you have a script (be it Fred's, or Snibgo's) that takes a base image as an argument.

For example a script that takes a input and output image and processes it in some magical way  :-)
CODE: SELECT ALL
   do_some_magick  input.png  output.png

Many times I ask it to display the result on screen without saving to a file

   do_some_magick  input.png show:

But it has always been harder to just give a 'blank' input image to the script, requiring you to do things like...

   convert -size 400x300 xc:Salmon miff:- | do_some_magick  miff:- show:

Or modify the script to generate a blank starting image.

Well here is a tip for you... Supply a blank canvas image of any size or color as a single argument....

   do_some_magick  'xc:Salmon[400x300!]' show:

NOTE the '!' is important as you are basically resizing a base xc: image, and without it the input will be a square 300x300 pixels (or something else if -size is set where it gets inserted into the IM command in the script).