Page 1 of 1

Half-byte shift in raw gray scale images?

Posted: 2008-07-07T00:41:29-07:00
by dave718
I'm trying to use ImageMagick to create "Analyze Format" images, and the raw gray scale files are almost equivalent except for some reason they shift everything over half a byte. (i.e. if you are looking at it in a hex editor, instead of seeing "01 AB 23 CD" you see "1A B2 3C D4".)

I'll admit that I'm more than a bit over my head here, but everything else is exactly the same (after flipping the image), so if anyone either a) knows how to easily shift an entire file over by 4 bits (ideally using Perl) or b) knows what setting I can change to fix this, I'd really appreciate it.

The command I'm using is basically "convert <files> -flip -adjoin gray:combined_file.img". Thanks.

Re: Half-byte shift in raw gray scale images?

Posted: 2008-07-07T06:07:08-07:00
by magick
ImageMagick should reproduce the same pixel values when all you are doing is flipping. Can you post a URL to one of your images so we can run your command and reproduce the problem?

Re: Half-byte shift in raw gray scale images?

Posted: 2008-07-07T17:03:47-07:00
by dave718
I've looked into it some more and there are bigger differences between the two formats which are posing difficulties. I'll probably have to stick with scripting ImageJ (which has support for "Analyze format" images) rather than using ImageMagick and trying to figure out the slight differences in the two binary formats. Thanks for the quick response though. -Dave