Is it possible to create 8-bit grayscale JPEG-2000?
Posted: 2016-12-21T11:00:34-07:00
I am attempting to use Magick.NET to create JPEG-2000 images in C#. (My library came from the ZIP file Magick.NET-7.0.3.500-Q8-x86.) I'm starting from a data array of bytes, creating a C# Bitmap object (called "bmp"), creating a MagickImage from that Bitmap, and writing to a file:
This code successfully creates valid JPEG-2000 files that I can open in FastStone Image Viewer. However, FastStone reports that these are 24-bit RGB files. I want to create 8-bit Grayscale JPEG-2000 files. Is there a command I can call that will change this setting?
I've searched the forum; here are some relevant topics I've found:
This user seems to have had success creating grayscale JPEG-2000 files. Attempting to call equivalent commands in Magick .NET doesn't work for me.
This user seems to have created grayscale JPEG-2000 files. (No details provided.)
This user wanted to create 16-bit grayscale files. (Unresolved.)
Code: Select all
using (MagickImage m = new MagickImage(bmp))
{
m.Format = MagickFormat.Jp2;
m.Settings.SetDefine(MagickFormat.Jp2, "quality", "80");
m.Write(jpeg2000FullPath);
}
I've searched the forum; here are some relevant topics I've found:
This user seems to have had success creating grayscale JPEG-2000 files. Attempting to call equivalent commands in Magick .NET doesn't work for me.
This user seems to have created grayscale JPEG-2000 files. (No details provided.)
This user wanted to create 16-bit grayscale files. (Unresolved.)