Page 1 of 1

Mosaic two pngs, one without and one with alpha

Posted: 2007-04-09T10:43:58-07:00
by saptarshi
Hi,
I have two images. I have created a shadow background for one

convert NW20Vq1.png -background black -shadow 80x3+5+5 final.png

This works = final.png has transparancy, but NW20Vq1 does not.
And then i mosaic the two together

convert final.png NW20Vq1.png -background none -mosaic y.png

However, i get the following error

convert: Pixel cache allocation failed `final.png'.
convert: Memory allocation failed 'y.png'
Warning: recursive semaphore lock detected!

If i mosaic two images(pngs) none of them with alpha, the mosaic works.
I'm running Linux, and have installed Imagemagick in my home directory (along with PerlMagick).
This however works on OS/X.

Could someone help me out?
Thanks for your time.
Regards
Saptarshi

Re: Mosaic two pngs, one without and one with alpha

Posted: 2007-04-09T11:06:43-07:00
by Bonzo
Are you just trying to add shadow to an image? If so try this for your second line:

Code: Select all

convert final.png -composite NW20Vq1.png -composite shadow_test.png

Re: Mosaic two pngs, one without and one with alpha

Posted: 2007-04-09T11:43:23-07:00
by saptarshi
Hi,
Thank you. However that didn't work (probably my mistake) - though it did lead me to the solution.
Suppose final.png is the shadow and NW20Vq1.png is the original png to which i wish to add the shadow.

I tried using your command but i got the error

convert: missing an image filenaname 'shadow_test.png'

I tried

convert -composite NW20Vq1.png -composite final.png shadow_test.png
This ran, but no shadow, i flipped sequence of images but to no avail.

I then tried
composite NW20Vq1.png final.png x.png

and x.png contained the drop shadow.

However, how can i get it to work with convert?


Thank you
Saptarshi

Re: Mosaic two pngs, one without and one with alpha

Posted: 2007-04-09T11:47:20-07:00
by Bonzo
My original image was boots_layer_2.png and I used php to run the code

<?php
// This creates the shadow
exec("convert boots_layer_2.png -background black -shadow 80x3+5+5 final.png ");
// This puts the original image on top of the shadow
exec("convert final.png -composite boots_layer_2.png -composite shadow_test.png");
?>

Output on this page http://www.rubblewebs.co.uk/imagemagick/other.php

Re: Mosaic two pngs, one without and one with alpha

Posted: 2007-04-09T11:55:25-07:00
by saptarshi
Hi,
Thanks again for the code, unfortunately this is my output

Code: Select all

convert NW20Vq1.png -background black -shadow 80x3+5+5 final.png
convert final.png -composite NW20Vq1.png  -composite shadow_test.png
convert: missing an image filename `shadow_test.png'.
I wonder why this is happening
My version of convert is
Version: ImageMagick 6.3.3 04/06/07 Q16 file:///home/sguha/mine/share/doc/ImageMagick-6.3.3/index.html
Copyright: Copyright (C) 1999-2007 ImageMagick Studio LLC

Re: Mosaic two pngs, one without and one with alpha

Posted: 2007-04-09T12:04:01-07:00
by Bonzo
That is strange !

I am using Version: ImageMagick 6.2.8 06/10/06 Q16

I am afraid that I have no idea apart from give composite a try:

Code: Select all

exec("composite final.png NW20Vq1.png shadow_test.png");

Re: Mosaic two pngs, one without and one with alpha

Posted: 2007-04-09T12:14:20-07:00
by saptarshi
Hi,
I've managed to get it working with composite. Now, my next challenge is to get a thin shadow all arround the image - not a drop shadow as such. Something like iPhoto thumbnail shadows.

Thank you for your time.
Rgds
Saptarshi

Re: Mosaic two pngs, one without and one with alpha

Posted: 2007-04-09T19:46:17-07:00
by anthony
your original errors sould more like a memory problem, with your commands running out of memory. just how big are the images?

Re: Mosaic two pngs, one without and one with alpha

Posted: 2007-04-09T21:04:06-07:00
by saptarshi
Hi,

Code: Select all

file NW20Vq1.png 
NW20Vq1.png: PNG image data, 1268 x 946, 16-bit/color RGB, non-interlaced
This is on a machine running
2.6.9-42.0.3.ELsmp #1 SMP x86_64 x86_64 x86_64 GNU/Linux
and 4GB ram (its a Dell, but i forget the model).

Thanks
Saptarshi

Re: Mosaic two pngs, one without and one with alpha

Posted: 2007-04-09T23:30:01-07:00
by anthony
That does not sound like it should run out of memory. Is it posible to give us a link to the image to try out?

Re: Mosaic two pngs, one without and one with alpha

Posted: 2007-04-10T08:08:18-07:00
by saptarshi
Hi.
Unfortunately due to privacy issues I can't share the PNG (its a graph of some data).
However, it works now.... i have no idea why but all is well.

I appreciate everybody's time and effort.

Regards
Saptarshi