This project has moved. For the latest updates, please go here.

PC vs Mac byte order?

Jul 9, 2014 at 12:25 PM
Is there a way to force a .tiff file to be saved with PC byte order instead of MAC byte order when doing a conversion?

Thanks
Coordinator
Jul 9, 2014 at 1:04 PM
Edited Sep 20, 2014 at 9:09 AM
The tiff writer should use the default byte order of your system. But you can force it like this:
using (MagickImage image = new MagickImage("input.tiff"))
{
  image.SetDefine(MagickFormat.Tiff, "endian", "lsb"); // PC
  // or
  image.SetDefine(MagickFormat.Tiff, "endian", "msb"); // Mac
  image.Write("output.tiff");
}
Jul 13, 2014 at 5:33 PM
Edited Jul 13, 2014 at 5:37 PM
Cool. Thanks. In in terms of determining the byte order of an image I'm seeing this particular issue. If you look at both of the following files:
  1. https://www.dropbox.com/s/9n2r73bk28u0x6e/24725_007_0732_R_T_TEST1MAC.tif
  2. https://www.dropbox.com/s/xmofwctkl3xpx6k/24725_007_0732_R_T_TEST2-BM.tif
If I use Magick and create a MagickImage object for both, and look at the .Endian property, they both say "MSB". If I use ExifTool to look at the metadata, one file says the Exif Byte Order is Big-endian(Motorola, MM) and the other one says Exif Byte Order is Little Endian(Intel, II).

I'm confused. I know one was saved in Photoshop where Byte Order was Mac and the other was PC. Am I understanding the properties wrong and how would I go about seeing "Big-endian" and "Little-endian" using Magick.
Coordinator
Jul 14, 2014 at 5:52 PM
Edited Jul 14, 2014 at 8:29 PM
I would also expect that image.Endian would report the correct value. I will have to contact one of the ImageMagick developers and ask why this was implemented otherwise. I will get back to you when I know more.

Edit: This appears to be a bug in ImageMagick, it will be fixed in the next release of Magick.NET.