php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #21630 imageCreateFromGIF doesn't work
Submitted: 2003-01-14 04:07 UTC Modified: 2003-01-18 21:20 UTC
From: steveh at brendata dot co dot uk Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.0 OS: Linux 2.4.20
Private report: No CVE-ID: None
 [2003-01-14 04:07 UTC] steveh at brendata dot co dot uk
imageCreateFromGIF followed by an attempt to rescale doesn't work, it produces a blank image.
Attempted with various valid gif files, imageCreateFromJPEG works fine.

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-14 04:08 UTC] derick@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

 [2003-01-14 04:36 UTC] steveh at brendata dot co dot uk
I'm not sure what else I can provide?
The system was built usign the standard bundled gd library with php.

Can you supply any specific questions or information you need?

I also searched deja.com and there are a few questions there which seem to imply other people are seeing the same problem.
 [2003-01-14 04:38 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

bundled GD doesn't support GIF due to patent issues.
Not a bug -> bogus
 [2003-01-14 04:40 UTC] steveh at brendata dot co dot uk
I think the documentation states that read only is supported, but not write?
I'll go and find the reference, maybe this is a documentation issue?
 [2003-01-14 04:45 UTC] nicos@php.net
It says:

Note:  Since all GIF support was removed from the GD library in version 1.6, this function is not available if you are using that version of the GD library. 

(nothing about read or write which is right because the function is just not supported)

but it says nothing about the gd bundled version, I'm fixing that.
 [2003-01-14 04:47 UTC] steveh at brendata dot co dot uk
Here's one bit from the ChangeLog, I also saw it in the documentation somewhere as well.

Added read-only GIF support for bundled GD2 library. (Rasmus)
 [2003-01-14 04:53 UTC] derick@php.net
okay, can you then provide a tar file which contains a) your script and b) the gif file so that we can try to reprocude it?

Derick
 [2003-01-14 04:56 UTC] steveh at brendata dot co dot uk
Happily, what's the easiest way to get the tar file attached or can I email it to you (I'll include a GIF, but it doesn't seem to matter as I tried it with a few just in case that was the issue).
 [2003-01-14 04:56 UTC] derick@php.net
please put it somewhere on the web, and provide the URL here.

Derick
 [2003-01-14 05:19 UTC] steveh at brendata dot co dot uk
tar located at
http://support.brendata.co.uk/phpbug21630.tgz
can be run from the command line.
 [2003-01-14 05:33 UTC] steveh at brendata dot co dot uk
Just to confirm, I just checked in phpinfo, and I am using the bundled GD (you made me wonder whether I had built php correctly).
 [2003-01-14 13:20 UTC] steveh at brendata dot co dot uk
I've managed to resolve this, it's not a bug with the ImageCreateFromGIF function, but the ImageCopyResampled, the blank image needs to be created with ImageCreateTrueColor or the resultant image is blank.

Not sure whether this becomes a bogus bug or whether the real issue is with ImageCopyResampled?

In fact, I've just looked at the user notes for ImageCopyResampled and people are saying there to use Truecolor.
 [2003-01-14 13:32 UTC] derick@php.net
Should be documented (better) then.

Derick
 [2003-01-14 14:00 UTC] pajoye@php.net
Hello,

I confirm (if necessary) the Derick's comment.

This a problem due to palette images limitations (255+1 colors). Resampling or filtering an image needs commonly more colors than 255, a kind of approximation is used to calc the new resampled pixel and its color, with a palette image we try to allocate a new color, if that failed, we choose the closest (in theory), the closest computed color is not always the closest visual color. That produces weird result, like blank (or visually blank) images.

You can reproduce this problem with imagerotate used with a palette image (imagecreate), allocate 3 colors, draw 2 differents boxes, and rotate the image with a custom angle (not a quarter angle), you will get a blank image or near blank.

Hope that helps,

pierre
 [2003-01-14 14:42 UTC] sniper@php.net
http://www.boutell.com/gd/manual2.0.10.html

"Pixel values are only interpolated if the destination image is a truecolor image. Otherwise, gdImageCopyResized is automatically invoked. "

(doesn't this mean that it's a bug in GD library itself?)

 [2003-01-14 16:16 UTC] pajoye@php.net
I never look gdImageCopyResized until now :) (simply too bad thing ;-). The problem seems to be the same. It uses the color resolver function, which causes exactly the same thing.

To skip this problem, please use a truecolor image as a destination image. That will not be fixed in a near futur. It's not really a bug.

thank's for your interest,

pierre
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Aug 17 01:01:29 2024 UTC