Skip to content
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

I have an RGBA32 raw image, but I cannot convert it #381

Closed
TileTurnip opened this issue Feb 3, 2019 · 1 comment

Comments

@TileTurnip
Copy link

commented Feb 3, 2019

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am using the latest version of Magick.NET

System Configuration

  • Magick.NET version: 7.10.2
  • Environment (Operating system, version and so on): Windows 10

Question

The raw image should be 1024x1024.
But the exception happens to me.
qq 20190203132042

How to deal with it?
Here is my sample.
sample.zip

Thanks for reading it.

@dlemstra dlemstra added the question label Feb 3, 2019

@dlemstra

This comment has been minimized.

Copy link
Owner

commented Feb 3, 2019

You did not tell me your Magick.NET version so this might be the wrong conclusion but I think you are using a 16 bit version of Magick.NET and you are reading an 8 bit image. What you could do is switch to 8 bit or you could use PixelStorageSettings and change your code to this:

var fileName = "c:/projects/sample.ptx";

var data = new byte[0x400 * 0x400 * 4];

var fs = File.OpenRead(fileName);
fs.Read(data, 0, 0x400 * 0x400 * 4);

var settings = new PixelStorageSettings(0x400, 0x400, StorageType.Char, PixelMapping.RGBA);

using (var image = new MagickImage(data, settings))
{
}

@TileTurnip TileTurnip closed this Feb 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.