Page 1 of 1

RAW Data length error (PixelStorageSettings issue)

Posted: 2019-02-28T12:34:09-07:00
by pablobhz
Hello Everyone.
I'm trying to create a new MagickIMage object from some raw CMYK Data.
In order to do so, i'm creating some PixelStorageSettings (as i learned before somewhere else, i think on some MagickImage doc site).

However, if i create the PixelStorageSettings with their original size, i get an error saying the array length is wrong
To be more specific:
The image width is 1497, height 1216
The data is 1,820,510 bytes

When i try to create it, the exception thrown is:
"System.ArgumentException: 'The array length is 1820352 but should be at least 7281408."

But i don't have any more data rather than this. The data stripped from the file is this. Nothing else more.

I did an test dividing width and height by two ; when i did that i was able to create the image.

Is there anything i'm missing ?
I'm posting my code here as well link to the files:

Thanks !

Code: Select all

var currSettings = new PixelStorageSettings(1497, 1216, StorageType.Char,PixelMapping.CMYK);
                MagickImage cyan = new MagickImage(@"C:\test\cyantwo.raw",currSettings);
                MagickImage magenta = new MagickImage(@"C:\test\magentatwo.raw", currSettings);
                MagickImage yellow = new MagickImage(@"C:\test\yellowtwo.raw", currSettings);
                MagickImage black = new MagickImage(@"C:\test\blacktwo.raw", currSettings);
Files: ... sp=sharing

Re: RAW Data length error (PixelStorageSettings issue)

Posted: 2019-02-28T20:36:41-07:00
by dlemstra
Your settings says you want to read a whole CMYK image at once but your files only contain one channel. You should read them as gray add them to a MagickImageCollection and call Combine to make one image.

Re: RAW Data length error (PixelStorageSettings issue)

Posted: 2019-03-01T11:30:49-07:00
by pablobhz
So i can combine the four channels into a single image array and then read with the PixelStorageSettings ?
Nice ! I'll give it a try right now and i'll post here my results.