Welcome Guest, Not a member yet? Register   Sign In
Image lib black background on crop
#1

[eluser]zbrox[/eluser]
Hi there,

I'm trying to resize an image to a smaller one with different proportions. The resulting image comes out with an area of black where's the extra space. However I need it to be either transparent, or white, but not black Smile
I edited the Image library so that it would resize PNG's without losing the transparency. I added this:
Code:
if ($this->image_type == 3 || $this->image_type == 1) {
             //Using alpha channel
             imagealphablending($dst_img, false);
             imagesavealpha($dst_img,true);
             //Allocating transparent color
             $transparent = imagecolorallocatealpha($dst_img, 255, 255, 255, 127);
             //full image filled with transparent color
             imagefilledrectangle($dst_img, 0, 0, $this->width,  $this->height, $transparent);
           }

Judging by it imagefilledrectangle gets $transparent as a background color, I tried changing it to the $white variable used above in the code, but still the result is a black background.
Any ideas why this is happening?


Messages In This Thread
Image lib black background on crop - by El Forum - 01-31-2010, 09:41 AM
Image lib black background on crop - by El Forum - 01-31-2010, 11:19 AM
Image lib black background on crop - by El Forum - 01-31-2010, 11:20 AM
Image lib black background on crop - by El Forum - 01-31-2010, 11:22 AM
Image lib black background on crop - by El Forum - 04-24-2010, 02:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB