Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: JPEG-2000 encoder does not respect ColorSpace changes

$
0
0
I am unsuccessfully attempting to use Magick.NET to create 8-bit grayscale JPEG-2000 files. The Magick.NET library (version 7.0.3.500-Q8-x86) appears to not respect any changes to the ColorSpace.

The following is the sample code I am using:
using (MagickImage m = new MagickImage(bmp))
{
    m.Format = MagickFormat.Jp2;
    //m.Settings.SetDefine(MagickFormat.Jp2, "colorspace", "gray");
    //m.Settings.ColorSpace = ColorSpace.Gray;
    m.Settings.SetDefine(MagickFormat.Jp2, "quality", "80");
    m.Write(jpeg2000FullPath);
}
Notes: "bmp" is a bitmap created from a 8-bit data array. To set the colorspace, I uncomment one of the above commented-out lines of code.

For comparison, the following command-line ImageMagick command works fine:
convert test.bmp -colorspace gray test.jp2
I have confirmed with exiftool that the command-line tool properly changes the colorspace to Grayscale and number of bands to 1, whereas the Magick.NET code leaves the colorspace as RGB and number of bands as 3.

I've also posted on the ImageMagick forums, where I have unsuccessfully attempted a couple of fixes; see here:

ImageMagick forum - "Users" thread
ImageMagick forum - "Magick.NET" thread

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>