3

There are images which are in Bitmap format i need to convert it to jpeg2000 form. can you please tel me steps included in this.how can images can be converted from bmp to jpeg2000. how can i do this thank you in advance

pdp
  • 609
  • 9
  • 22

4 Answers4

3

You could use Magick.NET (https://github.com/dlemstra/Magick.NET).

using (MagickImage image = new MagickImage("input.bmp"))
{
  image.Write("output.jp2");
}
Matthieu Charbonnier
  • 2,794
  • 25
  • 33
dlemstra
  • 7,813
  • 2
  • 27
  • 43
1

You can use Jpeg2000.Net library. Disclaimer: I am working on this library, the library is commercial.

Here are basic samples for encoding of BMP image to JPEG 2000:

a. Lossless encoding

J2kImageData imageData = J2kImageData.FromImage("input.bmp");
imageData.Encode("output-lossless.j2k");

b. Encoding with compression

J2kImageData imageData = J2kImageData.FromImage("input.bmp");

var options30x = new J2kEncodingOptions
{
    Codec = J2kCodec.J2k,
    QualityMode = J2kQualityMode.CompressionRatio,
    QualityValues = new float[] { 30 }
};
imageData.Encode(@"output-30x.j2k", options30x);
Vitaliy Shibaev
  • 1,420
  • 10
  • 24
0

Not sure how exactly you would like to do it, however, you may want to look into ImageMagick features. http://www.imagemagick.org/script/jp2.php

pree
  • 2,297
  • 6
  • 37
  • 55
-2

Use FileStream .

byte[] raw = File.ReadAllBytes("pic.bmp");

using(Image img = Image.FromStream(new MemoryStream(raw)))
{
    img.Save("pic.jp2", ImageFormat.Jpeg);
}
Ayyappan Sekaran
  • 986
  • 4
  • 12
  • 27