PNG transparency #4

Closed
deivian opened this Issue Jul 12, 2012 · 4 comments

3 participants

@deivian

Just wondering if there is a way of resizing the PNG files without losing the transparency layer :)

@maikeldaloo
Owner

I'm sure there's a way and I spent an hour or so today trying to get it working with no luck.
I'll try again later.

@deivian

I spent few hours today too doing some research with no luck either. But finally I found something, a PHP object-oriented library for image manipulation called WideImage (http://wideimage.sourceforge.net). Maybe it can help :)

@maikeldaloo
Owner

Oh wow, that looks pretty similar to what I have.
I send them an email and see if they mind if I turned their image manipulation class into a Laravel bundle :)

Thanks for the suggestion, and good find!

@lavaeagle

I think this may be of help: http://www.php.net/manual/en/function.imagecopyresampled.php#104028

// preserve transparency
if($type == "gif" or $type == "png"){
imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));
imagealphablending($new, false);
imagesavealpha($new, true);
}

I'm going to come up with a mock later.

@maikeldaloo maikeldaloo closed this Dec 5, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment