>It's been over a year since I've had to come to you for help, but your 
>insights and experience are too hard to resist... :-)
>
>I don't have a problem with any of the gd functions and they all works 
>fine except that when I try to fill a circle or draw onto an imported 
>image from imagecreatefromjpeg:
>
>When I create my working jpg image from scratch:
>
>$im = ImageCreate($sizew, $sizeh);
>$black = ImageColorAllocate($im, 0, 0, 0);

>I decided to cut out the 200+ lines of stripe drawing code and import 
>the fixed stripped image using imagecreatefromjpeg to draw and fill the 
>circle and arrow onto:
>
>...
>
>$im = imagecreatefromjpeg("stripes.jpg");
>$black = ImageColorAllocate($im, 0, 0, 0);
>
>ImageArc($im, $arrwell, $arrwell, 10, 10, 0, 360, $black);
>ImageFillToBorder($im, $arrwell, $arrwell, $black, $black);
>
>...
>
>The problem is that now the Arc and arrow lines comes out in a reddish 
>color and the fill to border doesn't fill (regardless of the color used 
>in ImageArc).
>
>Anything I attempt to draw in any color comes out in red (it doesn't 
>matter what the stripe color behind it is, it's still the same red).

Try using the TrueColor functions.

I suspect that while it's possible for the JPEG to have a zillion colors,
the actualy pallette in use for any particular image is limited.

Once you hit that limit, it gets ugly fast.

Before the True Color stuff came along, I wrote some really gnarly code that
would essentially search out the least-used color, de-allocate that one --
which automatically re-mapped that color to the nearest, I think, and then I
was able to allocate my new color flawlessly.

You really don't want to use this code, since scanning the whole image for
all the colors and building up the frequency table is extremely inefficient,
and almost-for-sure the True Color stuff will take care of you.

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

Reply via email to