-
-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initialize MagickImage from ushort array #1142
Comments
The internal API requires a byte array. Why is your image data an ushort array? |
My input is from an industrial camera: ushort array of 16-bit gray values. But if the internal API requires a byte array this conversion can not be avoided. Thanks. :) |
If those are just pixels you could also do this: var width = 100;
var height = 100;
ushort[] data = GetData();
using var image = new MagickImage();
using var pixels = image.GetPixels();
pixels.SetArea(0, 0, width, height, data); |
This fails for me with "Invalid X coordinate: 0. Parametername: x'" I think this is because Height and Width are not set for the MagickImage. |
Woops sorry :) You should indeed set the size of the image, that should be: |
I couldn't get it working. It wants three channels, I only have one. ;) System.ArgumentException: 'Values should have 3 channels. Parametername: values' |
I keep forgetting that I have a |
Thank you @dlemstra :) What "mapping" can I use for PixelReadSettings when I have gray values? I tried "R" and it works, but it feels wrong. ;) |
Maybe |
Hello,
would it make sense to implement a MagickImage constructor which takes a ushort array instead of a byte array (for Q16)?
My input data is a ushort array and at the moment I have to convert it into a byte array using Buffer.BlockCopy. This conversion takes ~30 ms for large images. Can this conversion be avoided or does the internal C API require bytes?
The text was updated successfully, but these errors were encountered: