Skip to content

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

@emcconville

Description

@emcconville

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions