Re: [PHP] GD, problem adding text to GIF images

2004-12-17 Thread Richard Lynch

Greg Donald wrote:
 On Thu, 16 Dec 2004 12:27:27 -0700, Vail, Warren [EMAIL PROTECTED]
 wrote:
 I believe that is the nature of GIF images, I seem to recall they were
 very
 compact but limited to a maximum of 16 colors (or 32 or some number like
 that[maybe 64]), fewer colors that JPEG.  Anyone know exactly?

 gifs are 8bit, 256 colors.

GIFs can have lower than that as well.

You can find the GIF format definition on-line -- It's not *that* tricky
to read and understand, really.

I wrote a GIF parser in Lisp one time.  Damned if I remember why...

Maybe they had no GIF support back then, and I was converting it to a PICT
in Lisp.  [shudder]  I was young and foolish. :-)

Might have been the other way around -- writing a valid GIF from a PICT --
which would have been easier, I reckon, since I could have ignored some of
the complexities I didn't need...

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



Re: [PHP] GD, problem adding text to GIF images

2004-12-17 Thread Richard Lynch
Juan Nin wrote:
 I'm adding text to images using the native gd in PHP 4.3.9

 I have no problems with jpg images, but with gif ones, the colour of
 the text added to the image always results a dark grey
 The image itself and text are fine, but not the colour, which should be
 white..

 Has anyone experienced this problem?

 Used functions are:


   imagecreatefromgif
   imagettftext
   imagegif

When you create that image from the original GIF, you are inheriting the
COLOR PALLETTE that is in that GIF.

The original GIF maker may well have restricted you to, say, 4 colors, in
order to make the GIF really small, none of which colors are white.

I'm assuming you are using http://php.net/imagecolorallocate already, and
are trying to use  255, 255, 255 to get white.

However, if the pallette is only allowed to have 4 colors, and they are
already in use, you ain't gonna get your white color -- Your
imagecolorallocate will return -1 -- Which shouldn't work too good at all
in the rest of your script...

So I'm a bit confused exactly how you got the gray color.

That said, here are some possible ideas.

#1.
Check all your return codes from all your functions.  If you *think* you
are getting a color, but you get -1, something went wrong.  Catch it, deal
with it, and do something smart about it.

#2.
Use http://php.net/imagecreatetruecolor to make your image.
Then use http://php.net/imagecreatefromgif to pull in the GIF
Then use http://php.net/imagecopy to *copy* the GIF into your image.

#3.
There are PHP functions to examine the pallette.  Use them.  Figure out
where the gray is coming from and why.

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



[PHP] GD, problem adding text to GIF images

2004-12-16 Thread Juan Nin
Hi,

I'm adding text to images using the native gd in PHP 4.3.9

I have no problems with jpg images, but with gif ones, the colour of
the text added to the image always results a dark grey
The image itself and text are fine, but not the colour, which should be white..

Has anyone experienced this problem?

Used functions are:


imagecreatefromgif
imagettftext
imagegif


Thanks in advance,

Juan

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



RE: [PHP] GD, problem adding text to GIF images

2004-12-16 Thread Vail, Warren
I believe that is the nature of GIF images, I seem to recall they were very
compact but limited to a maximum of 16 colors (or 32 or some number like
that[maybe 64]), fewer colors that JPEG.  Anyone know exactly?

Warren Vail


 -Original Message-
 From: Juan Nin [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, December 16, 2004 10:20 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] GD, problem adding text to GIF images
 
 
 Hi,
 
 I'm adding text to images using the native gd in PHP 4.3.9
 
 I have no problems with jpg images, but with gif ones, the 
 colour of the text added to the image always results a dark 
 grey The image itself and text are fine, but not the colour, 
 which should be white..
 
 Has anyone experienced this problem?
 
 Used functions are:
 
 
   imagecreatefromgif
   imagettftext
   imagegif
 
 
 Thanks in advance,
 
 Juan
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re: [PHP] GD, problem adding text to GIF images

2004-12-16 Thread Greg Donald
On Thu, 16 Dec 2004 12:27:27 -0700, Vail, Warren [EMAIL PROTECTED] wrote:
 I believe that is the nature of GIF images, I seem to recall they were very
 compact but limited to a maximum of 16 colors (or 32 or some number like
 that[maybe 64]), fewer colors that JPEG.  Anyone know exactly?

gifs are 8bit, 256 colors.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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