Working with RGB values... 5 min work IF you know how to ...

This forum is now closed as part of retiring phpBB2
Forum rules
READ: Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
Peter VDD
Registered User
Posts: 140
Joined: Sun Oct 12, 2003 12:18 pm

Working with RGB values... 5 min work IF you know how to ...

Post by Peter VDD »

Ok I'll be very short and very precise: it's simply an image manipulation request that does almost nothing. The first part I already did, it's on the last 2 steps I'm asking for help.

You input an image $im_input (in for example .jpg format) and find its size.
for pixels 0 to $width, 0 to $height you make 3 arrays from the colorat:
$red[$x][$y] = ...;
$green[$x][$y] = ...;
$blue[$x][$y] = ...;
Then, manipulation the arrays in some way (like eum.. just halving blue... or whatever)
Composing the arrays into a new image ($im_output)

Now here's the problem: I can't get the right colors in my image. It does output, but unexpected results.
I did: imagecreatetruecolor($width, $height)
and said the $newcolor[$x][$y] = 256*256*$red[$x][$y]+256*$green[$x][$y]+$blue[$x][$y]; as argument for imagesetpixel()

But when writing the final image to a file, that resulted in strange results (not the expected color anyways).

Any help on this would be GREATLY appreciated!! :D
Post Reply

Return to “[2.0.x] MOD Requests”