Hello.
My task/problem is this:
I've made a script that takes images (in gif,jpg & png) and makes their
thumbs in jpg format. Now, the problem is if I have a transparent gif when
saved to jpg the part of the original picture that is transparent turns
black in the new thumb. My question is: how can I define that the
transparent part gets the color i want it to get (white is what i need) ?
Actually, I now what in theory should be done - I should change the r,g,b
values of the color that has aplha=127 (and that's not a problem with
imagecolorset() ), but also I should change the alpha of that color to 0 -
how can that be done ?
My quess is that that is the right way to do it, but I'm open to suggestions
?!?
btw, I've solved that problem like this (but there must be a better way???):
i allocate new color with:
$color = imagecoloralloc ate($image, $r, $g, $b);
and then every pixel in the original picture that has alpha=127 I color
with that new color:
imagesetpixel($ image,$x,$y,$co lor);
but, this is quite slow.
thanks.
My task/problem is this:
I've made a script that takes images (in gif,jpg & png) and makes their
thumbs in jpg format. Now, the problem is if I have a transparent gif when
saved to jpg the part of the original picture that is transparent turns
black in the new thumb. My question is: how can I define that the
transparent part gets the color i want it to get (white is what i need) ?
Actually, I now what in theory should be done - I should change the r,g,b
values of the color that has aplha=127 (and that's not a problem with
imagecolorset() ), but also I should change the alpha of that color to 0 -
how can that be done ?
My quess is that that is the right way to do it, but I'm open to suggestions
?!?
btw, I've solved that problem like this (but there must be a better way???):
i allocate new color with:
$color = imagecoloralloc ate($image, $r, $g, $b);
and then every pixel in the original picture that has alpha=127 I color
with that new color:
imagesetpixel($ image,$x,$y,$co lor);
but, this is quite slow.
thanks.
Comment