Avoid resampling colors in imagecopyresized() and imagecopyr

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
clunizzi
Forum Newbie
Posts: 1
Joined: Thu Oct 18, 2012 4:10 am

Avoid resampling colors in imagecopyresized() and imagecopyr

Post by clunizzi »

Hi coders!
i'm working around GD function for images. I'm using imagecopyresized() and imagecopyresampled() and i see that the colors of returned image are completly changed. For example, original RGB color was "3c3f70" at position (1,1) and become "656d61" in the output file at the same (i,j) position. I used imagecreatetruecolor() like php.net suggest, but doesn't work.
The original file is just a matrix of colors that i resize in a smaller one which must have the same colors. Is possible to avoid the colors changing in the output file?

Thanks in advantage, hope to solve this issue.

Andrea.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Avoid resampling colors in imagecopyresized() and imagec

Post by requinix »

Changing from a blue to a gray is unusual - GD often will change colors but only a very small amount (and perhaps only with palette images).
What's your code?
Post Reply