Reputation: 558
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.
Upvotes: 4
Views: 7020
Reputation: 16468
The http://imageresizing.net library preserves transparency when converting between GIF and PNG formats. It's open-source, so you can refer to the source code to see how to achieve it. I believe that the palette generation is key in maintaining transparency, but it's been a while since I made the last change to the GIF and PNG quanitization code - it's been stable for several years.
Upvotes: 0
Reputation: 43124
This is effectively what you are asking Why does resizing a png image lose transparency?
Upvotes: 2