Page 1 of 1

Usage Tip: Specify a Canvas as a Single Argument

Posted: 2015-08-05T18:16:28-07:00
by anthony
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

Code: Select all

   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...

Code: Select all

   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....

Code: Select all

   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).

I added the canvas generation technique to IM Examples, Canvas page.

Enjoy :-)