Page 1 of 1

detailed layout of MPC format?

Posted: 2018-05-03T15:24:58-07:00
by Rich_Morin
I plan to do image analysis on some large TIFF images. These are distributed (by USGS) as High Resolution Orthoimagery (HRO). A typical file might contain 12815 x 14632 (RGBA) pixels.

I'd like to convert these into MPC (Magick Persistent Cache) format, then map them into memory in my own (Elixir) application. However, I haven't been able to find a detailed layout description for MPC. I'd rather not have to reverse engineer this from the IM code base. Suggestions?

-r

Re: detailed layout of MPC format?

Posted: 2018-05-03T17:10:09-07:00
by snibgo
I have no other suggestions. As far as I know, the best documentation is mpc.c. It's a very simple format: some text in the mpc file, and uncompressed pixels in the cache file.

Re: detailed layout of MPC format?

Posted: 2018-05-03T18:32:28-07:00
by Rich_Morin
mpc.c is a bit over 1500 LOC; I can work my way through this if need be, but I'd rather avoid that pain. However, if someone familiar with the code is willing to dig out the details, I'd be happy to write up a wiki page, etc.

Re: detailed layout of MPC format?

Posted: 2018-05-04T06:26:37-07:00
by magick
MPC utilizes the same headers as the MIFF format described @ https://www.imagemagick.org/script/miff.php. The associated .cache file is a direct memory mapping of the image pixels. With IMv7, for example, an RGB image would typically include columns * rows RGB pixel floats. You can memory map the .cache file and get direct access to the pixels from your applications.