#19781 [Opn->Fbk]: ImageTrueColorToPalette() ignores color parameter

From: Date: Sun, 06 Oct 2002 17:30:41 +0000
Subject: #19781 [Opn->Fbk]: ImageTrueColorToPalette() ignores color parameter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-21649@lists.php.net to get a copy of this message
 ID:               19781
 Updated by:       rasmus@php.net
 Reported By:      sprice@wisc.edu
-Status:           Open
+Status:           Feedback
 Bug Type:         GD related
 Operating System: Darwin 6.1 (Mac 10.2.1)
 PHP Version:      4CVS-2002-10-06
 New Comment:

Is world_map_med.gd2 a truecolor image?  This function does nothing if
the image has a palette.


Previous Comments:
------------------------------------------------------------------------

[2002-10-06 12:18:35] sprice@wisc.edu

imagetruecolortopalette() is:
void imagetruecolortopalette ( resource image, bool dither, int
ncolors)

but the function seems to ignore my ncolors input. ncolors  should be
the maximum number of colors in the output image. (and I cannot tell if
dither works)

Test script:
<?php
header( "Content-type: image/png" );

$medimg = $_SERVER['DOCUMENT_ROOT'] .
"/riverdata/images/world_map_med.gd2";
$img = ImageCreateFromGD2Part( $medimg, 900, 500, 800, 600 );

//Avoid bug #19418
$medimg = ImageCreateTrueColor( 800, 600 );
ImageCopy( $medimg, $img, 0, 0, 0, 0, 800, 600 );
ImageDestroy( $img );
$img = $medimg;

ImageTrueColorToPalette( $img, FALSE, 2 );

ImagePNG( $img );
ImageDestroy( $img );
?>

You can find the GD2 image that I am using here:
http://144.92.10.251/riverdata/images/world_map_med.gd2

The previous episode in this saga can be seen here:
http://bugs.php.net/bug.php?id=19704

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=19781&edit=1



Thread (5 messages)

« previous php.bugs (#21649) next »