JPEG 2000 support in C#.NET

前端 未结 5 2058
生来不讨喜
生来不讨喜 2020-11-30 07:05

It seems that .NET can\'t open JP2 (Jpeg 2000) files using the GDI library. I\'ve searched on google but can\'t find any libraries or example code to do this.

Anybod

5条回答
  •  天涯浪人
    2020-11-30 07:32

    You can use Jpeg2000.Net library if you need a fully managed solution without unsafe blocks. Disclaimer: I am working on this library, the library is commercial.

    Here is the basic sample for decoding of JPEG 2000 image to TIFF:

    string fileName = ...; // path to JPEG 2000 image
    using (var image = new J2kImage(fileName))
    {
        var options = new J2kDecodingOptions
        {
            UpsampleComponents = true
        };
    
        // Alternatively, you can decode only part of the image using J2kImage.DecodeArea method
        var imageData = image.Decode(options);
        imageData.Save(tiffFileName, J2kOutputFormat.Tiff);
    }
    

提交回复
热议问题