Error when reading from mpc

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
kaigan
Posts: 4
Joined: 2012-03-13T02:26:09-07:00
Authentication code: 8675308

Error when reading from mpc

Post by kaigan »

Hi!

I am doing several different transformations on a single source (e.g. different sizes of the source) and therefore I thought it be a good idea to store the original in a temporary mpc-file when processing to speed up the process a bit. However I get the following error when trying to read from the mpc-file:

Code: Select all

unable to persist pixel cache `/data/magick/magick-XXBqHuFC' @ mpc.c/ReadMPCImage/903
The folder /data/magick has all permissions set for the executing user. I've tried to search for a sollution but only found some irrelevant information.

The mpc-file is stored in a temporary file generated with tmpfile(). As such I'm using Imagick::readimagefile() to load the file. Can someone please help me? I'm using CentOS 6.2 with Imagick 3.1.0RC1 (I have tried with 3.0.1 as well) with Imagemagick 6.5.4.7-5.el6
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Error when reading from mpc

Post by anthony »

NOTE a MPC: image is just a 'memory dump' of the image, which can be later directly 'paged-in' without needing parsing or decoding. It is already in memory format.

However MPC files are ONLY suitable for the exact ImageMagick program that produced it. Any re-compile of even the same version of ImageMagick, or even a MPC produced on another machine, will no work and at worse can cause a segmentation fault.

In summery. You can not use it for image storage of any appreciable amount of time

In other words it is only useful for temporary images, generally only for very short periods such as the life span of a specific program or script. Its advantage is it is very fast to write out, and read back in.

For more info see IM examples, File handling, MPC
http://www.imagemagick.org/Usage/files/#mpc
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
kaigan
Posts: 4
Joined: 2012-03-13T02:26:09-07:00
Authentication code: 8675308

Re: Error when reading from mpc

Post by kaigan »

anthony wrote:NOTE a MPC: image is just a 'memory dump' of the image, which can be later directly 'paged-in' without needing parsing or decoding. It is already in memory format.

However MPC files are ONLY suitable for the exact ImageMagick program that produced it. Any re-compile of even the same version of ImageMagick, or even a MPC produced on another machine, will no work and at worse can cause a segmentation fault.

In summery. You can not use it for image storage of any appreciable amount of time

In other words it is only useful for temporary images, generally only for very short periods such as the life span of a specific program or script. Its advantage is it is very fast to write out, and read back in.

For more info see IM examples, File handling, MPC
http://www.imagemagick.org/Usage/files/#mpc
Hi Anthony and thanks for your reply!

The thing is, we are using the mpc within the same process just a few seconds between reads and writes. If it that wouldn't be a suitable use for the MPC-format I don't know what is.
To clarify: I'm writing and reading the mpc-file from the same process, just different Imagick instances.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Error when reading from mpc

Post by anthony »

That should have no problems what so ever, and that is exactly how it is ment to be used.
I myself use it between seperate IM commands (from the same shell script)

What version of IM is it?

Note I can not run IMagick API myself. :-(
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
kaigan
Posts: 4
Joined: 2012-03-13T02:26:09-07:00
Authentication code: 8675308

Re: Error when reading from mpc

Post by kaigan »

anthony wrote:That should have no problems what so ever, and that is exactly how it is ment to be used.
I myself use it between seperate IM commands (from the same shell script)

What version of IM is it?

Note I can not run IMagick API myself. :-(
I'm running Imagemagick 6.5.4.7-5.el6 (also stated in my first post :wink: ).
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Error when reading from mpc

Post by anthony »

It should have no problems.

Note MPC actually saves two files. one with meta-data, and a second larger file with the memory dump.
Make sure IM can write (and read) both files.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply