Page 1 of 1

Saving file with different extension

Posted: 2008-11-09T11:46:15-07:00
by arron
Hi,
i need to solve problem, when i read image (jpg for example) and i want to write it as a jpeg in to file with different extension (tmp).
I tried:

Code: Select all

$im = new Imagick;
$im->readImage('30062007038.jpg');
$im->setImageFilename('aa.tmp');
$im->setImageFormat('jpeg');
$im->writeImage();
but i get exception:

Fatal error: Uncaught exception 'ImagickException' with message 'no encode delegate for this image format `aa.tmp'' in test.php:33 Stack trace: #0 test.php(33): Imagick->writeimage() #1 {main} thrown in test.php on line 33


Is there any chance to do this??
thx for any help.

Re: Saving file with different extension

Posted: 2008-11-09T14:07:04-07:00
by magick
TMP has a special meaning in ImageMagick. Saving to aa.abc for example works. To get around the problem, use a filename of jpeg:aa.tmp.

Re: Saving file with different extension

Posted: 2008-11-10T14:46:08-07:00
by arron
I maybe doing something wrong:

Code: Select all

$im->writeImage('jpeg:aa.tmp');
i'm still getting the same exception:-(