user2486709
user2486709

Reputation:

Using libpng in C#

if you want to save the image in PNG format you can use ImageFormat class of .Net. But this class doesn't implemented compression for PNG files. And for some reasons i can't save my file in JPEG format. After Some researched i know libpng is the official PNG reference library. But i can't find anything for using it in .net framework. Does anyone know about this library and using it in .NET?

About libpng

Thanks in Advanced.

Upvotes: 2

Views: 7204

Answers (3)

leonbloy
leonbloy

Reputation: 75896

Another alternative: PngCs

But this class doesn't implemented compression for PNG files

What on earth does that mean? PNG is compressed by design.

Upvotes: 3

dsfgsho
dsfgsho

Reputation: 2769

ImageMagick is a very nice library that allows you (among other things) create PNG files. Magick.NET is the .Net wrapper for this library. Using this library, you can simply convert/create image formats. E.g. from their documentation:

using (MagickImage image = new MagickImage("Snakeware.gif"))
{
   image.Write("Snakeware.jpg");
}

Upvotes: 2

user2485710
user2485710

Reputation: 9801

Since libpng it's written in C ( ANSI C, even better ) you can build a bridge between that library and your C# application -> Use a C library from C# code

There are also other options, such as freeimage and the port of ImageMagick to .net but in this case it's still unclear to me what kind of project is this one, I don't get if it's official or not, if it's already dead or alive, if you are interested you can search for that name.

In simple terms PNG it's a open standard where JPEG it's a world full of patents and royalties, for this reason some libraries do not offer jpeg features or they offer a limited set of jpeg related features/algorithms. PNG it's also a real imaging standard about a file format definition, jpeg it's more like a container.

Upvotes: 1

Related Questions