Re: [GD-DEVEL] Color bug in JPEG output with 2.0.36
[email protected] ("Pierre Joye") Sun, 30 Mar 2008 11:48:46 +0200
| Newsgroups | php.gd.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Ethan! On Sun, Mar 30, 2008 at 6:01 AM, Ethan A Merritt <[email protected]> wrote: > I am forwarding a bug report from a gnuplot user who > tried out the current gd 2.0.36RC: Thanks for this report! If it persists after our tests, can you open an issue in bugs.libgd.org please? > > I updated from 2.0.33 to the most recent test version, 2.0.36RC. The JPEG > > test no longer segfaults. However, the color of the sinusoid is brown > > instead of bright red as it is for the PNG output. > > And indeed, I can confirm that the colors coming out of JPEG are > strange. In particular, pure red is rendered as brown. As far as I can see, we did not change the JPEG codec since 2.0.29 except a sanity check (http://cvs.php.net/viewvc.cgi/gd/libgd/src/gd_jpeg.c). I can't reproduce the problem (if I got it correctly) here (linux/windows, 32 or 64bit). Can you try using the attached code (result image attached too)? Also it would help to have the script to reproduce it (gnuplot, c, php or perl). Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org
jpeg.c
(text/x-csrc, 735 B)
/* $Id: copyrotated.c,v 1.2 2008/02/28 09:49:52 pajoye Exp $ */
#include "gd.h"
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **arg)
{
FILE *fp;
gdImagePtr im;
im = gdImageCreateTrueColor(100, 100);
if (!im) {
fprintf(stderr, "Can't create a new image");
gdImageDestroy(im);
return 1;
}
gdImageFilledRectangle(im, 0, 0, gdImageSX(im), gdImageSY(im), gdTrueColorAlpha(255, 255, 255, 0));
gdImageFilledRectangle(im, 20, 20, gdImageSX(im) - 21, gdImageSY(im) - 21, gdTrueColorAlpha(255, 0, 0, 0));
fp = fopen("jpeg_out.jpeg", "wb");
if (!fp) {
fprintf(stderr, "Can't open jpeg file\n");
gdImageDestroy(im);
return 1;
}
gdImageJpeg(im, fp, 90);
fclose(fp);
gdImageDestroy(im);
return 0;
}