Composite errors on blank image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
socialkast_al

Composite errors on blank image

Post by socialkast_al »

First of all, let me say that switching to ImageMagick from JAI was one of the smartest things I've ever done. JAI is great. But, ImageMagick is stellar.

I've run into a problem though. We came across a need to combine two images. We have a placeholder that an image needs to go in which forces images to a certain size. But, the images we need to put there start really small so when we use IM to scale them, we wind up with an image you can no longer decipher (image is just way too small to start with). So, we want to create a blank image that is the right size and then put our super small image in the center of that blank image so that it does not get interpolated later.

We followed the example from the developer manual with the rose.jpg (composite -gravity center smile.gif rose: rose-over.png). That combined images just great. But, when we create a blank image, it does not. Can someone help me out? When we run this: composite -gravity center smile.gif convas: convas-over.png "Convas" is a blank image one of our developers created for the last test. We can create the blank canvas just fine. We can run the smile and rose example just fine. But, when we try to composite our created blank image with any other image, we get this:

Magick: no decode delegate for this image format `' @ error/constitute.c/ReadImage/532.
Magick: missing an image filename `convas-over.png' @ error/composite.c/CompositeImageCommand/1607.

We have checked and have all delegates. Can someone help me see what is wrong?

Best,
Al
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Composite errors on blank image

Post by el_supremo »

There is no canvas:, or convas:, pseudo image format. If you want a blank image you must use the -size option with the xc: pseudo format.

Code: Select all

composite -gravity center smile.gif -size 100x100 xc:black canvas-over.png
You can use the convert command to do the same thing but then the input file arguments are the other way round :

Code: Select all

convert -size 100x100 xc:black -gravity center smile.gif -composite canvas-over.png
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Composite errors on blank image

Post by Bonzo »

I would use Pete's convert example as you can do more with convert if you need to and you can composite more than one image where composite will only do two.
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: Composite errors on blank image

Post by Drarakel »

el_supremo wrote:There is no canvas: [...] pseudo image format.
It seems now there is:
http://www.imagemagick.org/script/formats.php (search for 'CANVAS')
Looks like an alias of xc: for the next IM version..?

But socialkast_al probably wanted to use a blank image that he created before. So, he should have replaced 'convas:' with the real file name:
composite -gravity center smile.gif convas.png convas-over.png
Or whatever his file is called..

But I would prefer Pete's line with convert, too.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Composite errors on blank image

Post by el_supremo »

There is no canvas: [...] pseudo image format.
I would've sworn it wasn't in that list just a minute or so before I posted that statement.
As Drarakel says, it looks like an alias of xc:, so in my examples canvas:black and xc:black will accomplish the same thing.

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Composite errors on blank image

Post by anthony »

Their is no 'coder' module specifically for canvas, but the XC: coder module is now registering itself as the coder for both 'xc' and 'canvas' image file formats. As such I would say they really are aliases.

However I have requested confirmation of this as there also is no ChangeLog entry for the addition.

The documentation should be updated when I get that confirmation.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Composite errors on blank image

Post by anthony »

I now have confirmation xc: ("X Constant Image") and canvas: are one and the same.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply