rukiman
rukiman

Reputation: 643

Magick.NET to read raw and write lossless JPEG

I am stumped. How do I read a grayscale 8bit raw image and convert to lossless JPEG? This the code I have to read the raw image, but it is failing with a runtime exception of ImageMagick.MagickMissingDelegateErrorException

MagickReadSettings settings = new MagickReadSettings();
settings.Width = 1000;
settings.Height = 800;
MagickImage image = new MagickImage("c:/users/rfonseka/desktop/image.raw", settings);

I am not sure how to convert it to JPEG2000 lossless format. I want to convert it in memory so I can output the bytes out to HTTP.

Upvotes: 0

Views: 1340

Answers (1)

dlemstra
dlemstra

Reputation: 8153

You need to put the executable dcraw.exe into the directory that contains the Magick.NET dll when you want to read raw files. The zip file ImageMagick-7.X.X-X-Q16-x86-windows.zip that you can download from https://www.imagemagick.org/script/download.php#windows contains this file.

If you are using the AnyCPU version of Magick.NET you will need to configure the cache directory and place dcraw.exe file in that directory.

MagickAnyCPU.CacheDirectory = @"C:\MyProgram\MyTempDir";

If you don't want to do this you will need to add the folder that contains the executable to your %PATH%.

Upvotes: 1

Related Questions