Error codes

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
fabrice4821
Posts: 4
Joined: 2016-09-28T11:54:43-07:00
Authentication code: 1151

Error codes

Post by fabrice4821 »

Hi,

I'm using imagemagick in my php code to convert PDF file in JPG pictures.

I'm using :

Code: Select all

exec('convert -density 300 -trim "'.$pdf_file.'" -quality 80 -resize 800 "'.$save_to.'"', $output, $return_var);
Some times, in the return_var I have the error number 9 or 1.

What are this errors ?

Best regard.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Error codes

Post by fmw42 »

I do not know. They sound like unix numbers. I believe IM only shows 0 or 1.

You should put your -trim after reading the PDF file and include +repage, for proper IM 6 or 7 syntax.

Please always provide your IM version and platform when asking questions, since syntax may differ.

If you want to see actual error messsages then change your command to

Code: Select all

<?php
exec('convert -density 300 "'.$pdf_file.'" -trim +repage -resize 800 -quality 80  "'.$save_to.'"' 2>&1, $output, $return_var);
foreach($output as $text)
{echo "$text<br>";}
?>
You do not say what the output image format is? If JPG then -quality is OK. But if some other format such as PNG, then -quality values are totally different. See http://www.imagemagick.org/script/comma ... hp#quality
fabrice4821
Posts: 4
Joined: 2016-09-28T11:54:43-07:00
Authentication code: 1151

Re: Error codes

Post by fabrice4821 »

Hi,

The output image format is jpg.

When I have the error 9 in $return_var, there are not information in $output

When I have the error 1 in $return_var, there are in $output:
Error: /ioerror in --showpage--
Operand stack:
1 true
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1878 1 3 %oparray_pop 1877 1 3 %oparray_pop 1861 1 3 %oparray_pop --nostringval-- --nostringval-- 3 1 40 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- 1761 0 9 %oparray_pop --nostringval-- --nostringval--
Dictionary stack:
--dict:1162/1684(ro)(G)-- --dict:1/20(G)-- --dict:75/200(L)-- --dict:75/200(L)-- --dict:108/127(ro)(G)-- --dict:290/300(ro)(G)-- --dict:22/25(L)-- --dict:6/8(L)-- --dict:27/40(L)--
Current allocation mode is local
Last OS error: 28
GPL Ghostscript 8.71: Unrecoverable error, exit code 1
convert: Postscript delegate failed `/home/gmapfp/test/vitry/images/livresfp/5/bulletin202016.compressed.pdf': mNul.cache @ error/pdf.c/ReadPDFImage/638.
convert: missing an image filename `/home/gmapfp/test/vitry/images/livresfp/5/bulletin202016.compressed.pdf-%d.jpg' @ error/convert.c/ConvertImageCommand/2940.
And I don't see error in my pdf file !

What is this message ?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Error codes

Post by snibgo »

It tells you that your very old version (v8.71) of Ghostscript had problems reading the PDF. Try upgrading GS.
snibgo's IM pages: im.snibgo.com
fabrice4821
Posts: 4
Joined: 2016-09-28T11:54:43-07:00
Authentication code: 1151

Re: Error codes

Post by fabrice4821 »

Hi,

Sorry for the time of the pause.

The vesrion on the server is : ImageMagick 6.6.0-4 2015-11-27 Q16

How I check the version of Ghostscript ?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Error codes

Post by fmw42 »

gs --version
fabrice4821
Posts: 4
Joined: 2016-09-28T11:54:43-07:00
Authentication code: 1151

Re: Error codes

Post by fabrice4821 »

The return is:
Array ( [0] => Version: ImageMagick 6.6.0-4 2015-11-27 Q16 http://www.imagemagick.org [1] => Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC [2] => Features: OpenMP [3] => [4] => 8.71 )
I'm on shared hosting and I can't upgrade the ImageMagick version.
Is there another solution for use this libraries ?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Error codes

Post by fmw42 »

That version is over 350 versions old. I suggest you try to get your ISP to upgrade or threaten to go to a different ISP.

You never answered the question about what version of ghostscript you are using.
Post Reply