how do i replace pixels colors with my own colors ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • luke noob
    New Member
    • Aug 2009
    • 69

    how do i replace pixels colors with my own colors ?

    Hi I am new to the GD library and am stuck on something and wondered if you could help me.

    I am using PHP and GD.

    I have an array with 40 predefined hexadecimal colors in it.

    I have an image that is 6 x 6 pixles, and I would like to loop through the pixles, swapping the colours in the image for my predefined colors.

    if say pixle 1 was already in my predefined colors i would like to leave it there and move to pixle no.2 else i would like to change that pixle in the image for the closest match that i have in my predefined colors.

    i would like to loop through the whole image untill the last pixle is complete.

    i have looked at imagecolorexact () , imagecolorresol ve() imagecolorclost est(), and even a mix of all, but i cant get my head around the best way of doing it. please help :)
Working...