detailed layout of MPC format?

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
Rich_Morin
Posts: 3
Joined: 2018-05-03T15:14:46-07:00
Authentication code: 1152

detailed layout of MPC format?

Post by Rich_Morin » 2018-05-03T15:24:58-07:00

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

snibgo
Posts: 10483
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: detailed layout of MPC format?

Post by snibgo » 2018-05-03T17:10:09-07:00

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.
snibgo's IM pages: im.snibgo.com

Rich_Morin
Posts: 3
Joined: 2018-05-03T15:14:46-07:00
Authentication code: 1152

Re: detailed layout of MPC format?

Post by Rich_Morin » 2018-05-03T18:32:28-07:00

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.

User avatar
magick
Site Admin
Posts: 10839
Joined: 2003-05-31T11:32:55-07:00

Re: detailed layout of MPC format?

Post by magick » 2018-05-04T06:26:37-07:00

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.

Post Reply