How to resize an image in .NET with transparency, both GIF and PNG, while maintaining transparency information

I found a lot of questions about resizing images in .NET and much more, but none of them seemed to talk about resizing images that have transparency (both 1-bit and GIF files, and alpha channels, such as PNG), obviously trying to preserve this transparency.

Maybe GDI / GDI + lacks some code to easily manage these scripts, or what else? If you can’t use .NET as it is, do you know about any library that can do this, not even free. I just wouldn't want it to be a command line tool (otherwise ImageMagick would likely do the trick easily) for better integration and automation.

Thanks guys. Yes, and the Gauls too.

+4
source share
2 answers
+2
source

The http://imageresizing.net library maintains transparency when converting between GIF and PNG formats. It is open source, so you can refer to the source code to find out how to achieve it. I believe that generating palettes is key to maintaining transparency, but it has been a while since I made the last change to the GIF and PNG quanitization code - it has been stable for several years.

0
source

Source: https://habr.com/ru/post/1302867/


All Articles