Pergunta

I'm doing a simple load of an image using imagecreatefrompng.

The background of the image is #E5DDBB. Using the code below, it renders the image but the background is now #DED6AD.

http://www.letslogic.com/test.php contains the following:

<img src="images/skins/yoshi/0.png">

<img src="dyn_image.php">

dyn_image.php contains:

<?php

$im = imagecreatefrompng('images/skins/yoshi/0.png');

header("Content-Type: image/png");

imagepng($im);

?>

If you look at the two images that test.php shows, the images are different colours...

Foi útil?

Solução

Apparently this is a color profile issue. Something to do with the image being of one color profile, whereas gd only lets you save your image in the one color profile it knows how to save images by which differs from the inputted image's, resulting in the colors looking different.

It seems you are going to need to use imagemagick to not have the colors changed. You should read these:

http://www.zenphoto.org/support/topic.php?id=3582

http://devot-ee.com/add-ons/support/ce-image/viewthread/1085

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top