Re: Merging two partially-transparent images results in black pixels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, March 18, 2006 9:16 pm, Jason Young wrote:
> I have an image that uses partial transparency for borders and such.
> At first, I tried using the whole image; creating a truecolor 'holder'
> image, then imagecopymerge-ing it, but that resulted in the outside
> transparent areas (the ones that would instead show the 'holder'
> image)
> were black, while the portions of transparency on the inside (these
> are
> rounded-squares) that had actual other images below them were white.

I think you maybe need to allocate a color in the holder image as the
background color...

> Then, I made two images. One having the outside transparency, and
> setting imagesavealpha to make it work as intended... then adding the
> needed images, then adding the 'window'-type transparent image on top.
> This gives the best result, but the 'window' image also has partial
> transparency, and is instead showing in black.

Again, try doing:
$white = imagecolorallocate($image, 255, 255, 255);

to 'set' the background color.

I think this behaviour change in different GD versions, though.

> I'm pretty much at wit's end. Everything's imagecopymerge'd, I've
> tried
> just about everything I could think of.
>
> Can you actually not have two transparent images on top of one
> another?

I'm almost certain you can, but keep in mind that any "overlap" in
them will probably come out darker than you think...

Each of the alpha blends will kick in consecutively to darken things.

At least, that was my experience with this, in my brief toying with it.

> Is there something else I can try?
> And as an offshoot question, why won't any transparent images natively
> load/import as transparent? I always seem to have to call
> imagecolortransparent on portions that are definitely transparent in
> Photoshop, etc.

Just the way it is, I think...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux