Imagick read MPC error "unable to persist pixel cache"

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
creonity
Posts: 4
Joined: 2012-12-06T04:10:50-07:00
Authentication code: 6789

Imagick read MPC error "unable to persist pixel cache"

Post by creonity »

Hi,

I'm trying to open an mpc (fully working in imagemagick command line) with imagick. However I keep getting an error:
Fatal error: Uncaught exception 'ImagickException' with message 'unable to persist pixel cache `/tmp/magick-XXfQ3soa' @ error/mpc.c/ReadMPCImage/905'

The temp path changes everytime eg. to /tmp/magick-XXWhMMD8

Version:
Debian 6.0.6
Imagick 3.0.0RC1
ImageMagick 6.6.0-4 2012-05-02 Q16 http://www.imagemagick.org

Any idea why it's looking in a "random" temp path?

Thanks for any help!
Lukas
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagick read MPC error "unable to persist pixel cache"

Post by fmw42 »

What is your exact command? Was the mpc file created in the same IM version? Are you able to open it in the command line, but not in PHP? Is that the issue? PHP ownership may be different from IM. Can you do what you want with some other image format? If so, perhaps you are missing the .cache image that is always associated with the .mpc file? Do you have correct permissions to open that file or for the directory where that file exists?
creonity
Posts: 4
Joined: 2012-12-06T04:10:50-07:00
Authentication code: 6789

Re: Imagick read MPC error "unable to persist pixel cache"

Post by creonity »

Hi,

thanks a lot for your reply!

1. What is your exact command?
My testcase:

Code: Select all

exec("convert watermark_large.png  -resize 64x64  resize_watermark.mpc");
$watermark = new Imagick("resize_watermark.mpc");
I can reuse resize_watermark.mpc with another IM command, but not with imagick.

2. Was the mpc file created in the same IM version?
phpinfo says ImageMagick 6.6.0-4. Since I installed imagick before imagemagick, it's possible that imagick installed another, older version. Is there a way I can check what version imagick uses, or point imagick to this version? Can't find any imagick conf information on my server.

3. Are you able to open it in the command line, but not in PHP? Is that the issue?
Yes, fine with command line (also in php with exec), not working wit imagick

4. PHP ownership may be different from IM.
Even if I give both files (resize_watermark.cache & resize_watermark.mpc) 777, it doesn't work

5. Can you do what you want with some other image format?
Yes

6. If so, perhaps you are missing the .cache image that is always associated with the .mpc file?
It's in the same folder as the mpc file. However it seems that imagick looks in a /tmp folder for the cache file

7. Do you have correct permissions to open that file or for the directory where that file exists?
I gave 777 to both files, working with other files
creonity
Posts: 4
Joined: 2012-12-06T04:10:50-07:00
Authentication code: 6789

Re: Imagick read MPC error "unable to persist pixel cache"

Post by creonity »

I can create mpc with imagick and then use that mpc with the command line, but not with imagick. I believe the error comes from a setting within imagick that looks for a wrong tmp folder.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagick read MPC error "unable to persist pixel cache"

Post by fmw42 »

creonity wrote:I can create mpc with imagick and then use that mpc with the command line, but not with imagick. I believe the error comes from a setting within imagick that looks for a wrong tmp folder.

Imagick is not supported well if at all any more and was not created by the ImageMagick team. So I am not sure what to tell you at this point other than to just use PHP exec() for everything. You are not gaining much if anything from Imagick and it does not support many of the newer Imagemagick features.

see
viewtopic.php?f=4&t=16779

Also check to see if you are using the latest version of Imagick and consider updating Imagemagick.

see
http://pecl.php.net/package/imagick/3.1.0RC2
creonity
Posts: 4
Joined: 2012-12-06T04:10:50-07:00
Authentication code: 6789

Re: Imagick read MPC error "unable to persist pixel cache"

Post by creonity »

Thanks for your reply.

Maybe an update helps. Otherwise I will benchmark Imagemagick against my imagick script (it's quite a complex one, but with MPC it may be fast).

Thanks, again.
Post Reply