-
Hello, Version : Magick.NET-Q8-AnyCPU.7.14.3 (tried with newer versions but the removal of the tobitmap() method affects other portions of my code base which I currently cannot modify.) Please let me know if I can provide any additional clarification. Any help would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
What is the format of the data? How is the image stored in the byte array? |
Beta Was this translation helpful? Give feedback.
-
The data is being read from an embedded binary file. The data is being
written directly from a capture system to this file. The array contains
data for 9 images and the size of the array is specified by the block in
the file I am trying to read.
…On Sun, May 9, 2021 at 11:08 AM Dirk Lemstra ***@***.***> wrote:
What is the format of the data? How is the image stored in the byte array?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#923 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACW7VMJB7XE3KSXLYEUQ4MTTM2QQJANCNFSM44PGHHGA>
.
|
Beta Was this translation helpful? Give feedback.
-
I, unfortunately, can't share any files since this is dealing with medical
data. I read the Image data that is embedded in a binary file and try to
feed it into ImageMagick. All I know for sure is that the images are raw
16-bit grayscale images and the data contains no encoding information. I
tried to load the original byte values into a System.Drawing.Bitmap but
when I tried to manipulate it I got some GDI+ errors when I tried to save
the bitmap, but once the values of the byte arrays were mapped to 32-bit
ARGB it worked fine. Not sure if the problem with Format16bppGrayScale in
Bitmaps persists into ImageMagick as well.
…On Mon, May 10, 2021 at 4:22 AM Dirk Lemstra ***@***.***> wrote:
Are there any specifications on how the image data is stored? Because
ImageMagick cannot just guess how the read the data. Can you share a file
and it's specification?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#923 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACW7VMJ4AF4ES7AS27AAABTTM6JSRANCNFSM44PGHHGA>
.
|
Beta Was this translation helpful? Give feedback.
-
The issue with ImageMagick/Magick.NET is that you are feeding it data and it has no idea what you are feeding it. You could do something like this to read raw pixel data: var data = GetByteArray();
var settings = new PixelReadSettings
{
Mapping = "R", // Only a single red (grey) channel
StorageType = StorageType.Short, // 16-bit per pixel
ReadSettings = new MagickReadSettings
{
// You probably need to change this to the correct value
Width = 100,
Height = 100
}
};
using (var image = new MagickImage())
{
image.ReadPixels(data, settings);
image.Write("yourfile.png");
} |
Beta Was this translation helpful? Give feedback.
The issue with ImageMagick/Magick.NET is that you are feeding it data and it has no idea what you are feeding it. You could do something like this to read raw pixel data: