setImageProperty Not Working After stripImage

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
patrickr
Posts: 3
Joined: 2011-10-09T11:03:27-07:00
Authentication code: 8675308

setImageProperty Not Working After stripImage

Post by patrickr »

Hi

I'm using PHP Imagick 3.0.1 with ImageMagick 6.7.6-8. When I try to add metadata to a png using the following code, my property is missing when I re-open it and call getImageProperties().

# read an image into $image...
$image->setImageProperty('test:x', '123');
$image->setImageFormat('png24');
$image->writeImage($saved_img_path);

Any idea what the problem could be?

UPDATE:

I realized what the problem was. I was calling stripImage before adding a property, on the assumption that stripImage wouldn't strip properties added after it was called.

Is there a way to read, strip, add a property, and save an image? Given how stripImage seems to work, I'd have to read and write the image twice. Once to strip and once to add my property.
Post Reply