views:

91

answers:

1

Hi, i found a lot of questions about resizing images in .NET and whatnot, but none of them seemed to talk about resizing images that have transparency (both 1bit like GIFs and w/ alpha channel like PNGs), trying obviously to keep that transparency.

Maybe GDI/GDI+ is somewhat lacking of code to easily manage those scenarios or what else? If it's not possible to use .NET as it is, are you aware of any library that can do that, even not free. I just wouldn't like it to be a command line tool (otherwise ImageMagick would probably do the trick easily) for better integration and automation purposes.

Thanks guys. Oh, and gals too.

+2  A: 

This is effectively what you are asking http://stackoverflow.com/questions/753968/why-does-resizing-a-png-image-lose-transparency

Lazarus
@lazarus: after 2 half days of reading answer like the one you pointed at, i happen to read that one too! but probably read it too fast and didn't get the part where it was explained how to deal with that, and just tought it was someone who didn't know that you typically loose transparency in the process. I'll now try that code and see if it works as i need to. Thanks by now!
njy
No problem, I struggled with the same problem myself recently and found that post very helpful.
Lazarus
@lazarus: ok, i've tried the code and it works beautifully for png->png rescaling. But if i try to do png->gif rescaling it fails. This may be ok, it's hard to transform an 8bit alpha channel (png) to a 1 bit thing (gif). But, and this is in part both obvious and bad, it doesn't even works for gif->gif rescaling. Any idea on how it would be possible to output resized gifs correctly?
njy
@njy, unfortunately all my efforts were PNG based. If I get a chance then I'll look into it a little further, in a development 'sprint' at the moment so not a great deal of time for investigation.
Lazarus