Hi
I'm struggling with a problem in some code that i'm writing. I need to upload an resize images using GDlib, but whenever I do this with transparent PNGs it gives them a black background.
Searching Google for possible solutions I came across this page: http://www.s9y.org/32.html (the todo list)
which has this excerpt:
"! Figure out how to preserve PNG and GIF transparency when resizing images with GDlib (FIX: PNG transparency works)"
Please could one of the developers shed some light on how you fixed this for PNGs please?
I'd really appreciate you help (and will donate!)
cheers
steve
How did you fix PNG transparency in resized images please?
-
steveparks
- Posts: 2
- Joined: Wed Jul 19, 2006 12:36 am
Code: Select all
/* Attempt to copy transparency information, this really only works for PNG */
if (function_exists('imagesavealpha')) {
imagealphablending($out, false);
imagesavealpha($out, true);
}
-
steveparks
- Posts: 2
- Joined: Wed Jul 19, 2006 12:36 am
Thanks
Hi
Many thanks for the suggestion. I've tried this out (the same code is at php.net) and am getting quality issues, with some black 'interference' around edges of the image.
Here's an example:

notice around the ears? it doesn't seem to deal well with curved edges.
Did you find a way to get round this in Serendipity please?
Thanks alot
Steve
Many thanks for the suggestion. I've tried this out (the same code is at php.net) and am getting quality issues, with some black 'interference' around edges of the image.
Here's an example:

notice around the ears? it doesn't seem to deal well with curved edges.
Did you find a way to get round this in Serendipity please?
Thanks alot
Steve
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Thanks
Hi!
What you can see there is the effect of lacking support for differentiaded transparency. Rounded edges are "simulated" by different levels of transparency (between 0 and 255). GIF for example only supports full (1) or no (0) transparency.
It might be related to your PHP setup, if this is possible. Which GDLib version are you using?
Serendipity can't do anything about this, this is completely up to the image processing tool (gdlib or imagemagick).
Best regards,
Garvin
What you can see there is the effect of lacking support for differentiaded transparency. Rounded edges are "simulated" by different levels of transparency (between 0 and 255). GIF for example only supports full (1) or no (0) transparency.
It might be related to your PHP setup, if this is possible. Which GDLib version are you using?
Serendipity can't do anything about this, this is completely up to the image processing tool (gdlib or imagemagick).
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/