[solved] JPG -> Multi-page PDF error

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
wKad

[solved] JPG -> Multi-page PDF error

Post by wKad »

Hi

I've got a problem trying do convert some .jpg files into a multi-page .pdf file. Dunno if I'm doing some terrible wrong, any help might be useful.

I try the following code:

Code: Select all

convert a.jpg b.jpg ab.pdf
And the windows return the windows "program has encountered a problem and must be closed" error...

By the way, the two following codes works fine:

Code: Select all

convert a.jpg a.pdf

Code: Select all

a.jpg b.jpg ab.gif
If I add the -verbose option, I get the following:

Code: Select all

convert -verbose a.jpg b.jpg ab.pdf
a.jpg JPEG 843x1166 843x1166+0+0 8-bit DirectClass 204kb
b.jpg JPEG 843x1166 843x1166+0+0 8-bit DirectClass 142kb
And then, the error...

I tried other forms of list the files, like

Code: Select all

convert *.jpg ab.pdf

Code: Select all

convert @aa.txt ab.pdf
And get the same error...

I'm running ImageMagick 6.5.1-1, GPL Ghostscript 8.64, and Windows XP Service Pack 3, and don't have a clue of what the problem can be... Searching in the foruns I found problems like this, but it's different, because the ImageMagick generate an error, and the output file is created with 0bytes.

As I tested, every convert from .jpg to .pdf occours perfectly (like -append, or -morph), except to create multi-pages... The only way I got a multi-paged PDF was with the -clone option, but it really don't help in my purpose.

Here and here you can see some screenshots of the situation.

Once again, any help migth be useful, and finnaly, sorry for the bad english.
Last edited by wKad on 2009-04-24T04:45:59-07:00, edited 2 times in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPG -> Multi-page PDF error

Post by fmw42 »

Perhaps it is your IM version or environment or images.

I tried:

convert rose.jpg rose.jpg rose.pdf

and it worked fine on IM 6.5.1-2 Q16 Mac OSX Tiger. I got a two page PDF.
wKad

Re: JPG -> Multi-page PDF error

Post by wKad »

Hi fmw42, thanks for your quick answer...

I just tested with other .jpg files, none of them works, with the same situation... But I also tried with .bmp and .png, and they works fine (generate a multi-page PDF).

So, I tried to convert my .jpg to .png, and after, to multi-page PDF. Something like this:

Code: Select all

convert a.jpg a.png
convert a.png a.png a.pdf
And it works! But the size of the final .pdf was about twice what it should be (because the .png file was bigger than the .jpg).

So, I tried to compress:

Code: Select all

convert a.png -compress JPEG a.pdf
It works fine, but when I try to convert two files into a pdf, with compression... I get the same error from before.

About the version, I downloaded and used the ImageMagick-6.5.1-Q16-windows.zip file... I just de-zipped it, and try the convert. Now, I'm downloading the ImageMagick-6.5.1-3-Q16-windows-dll.exe, with installer... Maybe the installer register some .dll or something that make a difference?

I will test this and back here the report any difference.

Thanks again for the help =)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPG -> Multi-page PDF error

Post by fmw42 »

could it be your jpg images. can you post two and I will try them?
wKad

Re: JPG -> Multi-page PDF error

Post by wKad »

Hi fmw42,

Sure, there are they:
* a.jpg
* b.jpg

They are a lot smaller than the originals (40KB and 27KB, instead of 205KB and 143KB), but I tried with they in this format too and the results are still the same.

By the way, some more information: I installed the ImageMagick-6.5.1-3-Q16-windows-dll.exe, and with it, the output .pdf file has some bytes (633b), but the process occours in the same mode, even with -verbose.

There are any know restriction for images that I should knew?

Thanks for the continued support =)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPG -> Multi-page PDF error

Post by fmw42 »

Works perfectly for me on IM 6.5.1-3 Q16 Mac OSX Tiger.

convert a.jpg b.jpg ab.pdf

http://www.fmwconcepts.com/misc_tests/ab.pdf


What delegates do you have installed? Do you have a current Ghostscript installed?

(Not sure if it is needed to read or to write pdfs)
wKad

Re: JPG -> Multi-page PDF error

Post by wKad »

Hi, fmw42

I've tried the process here in another PC, with similar configuration, the results are exactly the same.

About the GhostScript, I have it installed since I installed CutePDF, but I dunno the version... When I was trying do make the command works, I've downloaded the most recent version (I belive), 8.64, but was useless.

Now I've checked the http://www.imagemagick.org/download/delegates/ page, and found a installer of the GhostScript 8.15. I've uninstalled the 8.64, installed the 8.15, but got the same results...

About other delegates, I don't have downloaded any other. Since I initially don't installed IM, just un-zipped it, I don't think any other was installed...

Maybe some is required?

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

Re: JPG -> Multi-page PDF error

Post by fmw42 »

If CutePDF uses Ghostscript, I am surprised! Even if it did, IM would not know about it unless you manually install IM after installing Ghostscript.

To see what delegates you have installed, type

convert -list configure

Then look at the line starting with DELEGATES. It will list all the delegates that IM knows about.
wKad

Re: JPG -> Multi-page PDF error

Post by wKad »

Yes, now I think the problem is that IM don't know that ghostscript is there...

I've checked the delegates, this is what I've got:

DELEGATES bzlib freetype jpeg jp2 lcms png tiff x11 xml wmf zlib

Not a signal of "gs"... I searched in the forums about problems with ghostscript, found some tips about reinstall IM after the install of GS, but even after uninstalled IM and GS, installed GS, and after installed IM, the Delegates are still the same

I've also checked the delegates.xml file... It have some references to "pdf", but none to "jpg to pdf"...

<delegate decode="eps" encode="pdf"...
<delegate decode="pdf" encode="eps"...
<delegate decode="pdf" encode="ps"...
<delegate decode="ps" encode="pdf"...

Again, I don't know if this is correct, or if I should add some new line or something like that. Oh, the "command" in every line above was like "@PSDelegate@", should I change it to the GS dir?

Everything is installed in the default directory ("C:\Arquivos de programas\ImageMagick-6.5.1-Q16", "C:\Arquivos de programas\gs\gs8.64"), and I've tried the versions 8.15 and 8.64 of GS (I've found in somewhere in the web saying that 8.10 was recommended, but here I only found 8.15 or higher)

Oh, thanks again for all the help.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPG -> Multi-page PDF error

Post by fmw42 »

GS may still be installed. I have been having trouble with the latest releases of IM not showing gs in the Delegates list even though I know it is there and works fine for me.

See viewtopic.php?f=3&t=13573
wKad

Re: JPG -> Multi-page PDF error

Post by wKad »

Hi, fmw42 =)

Thank you for your kindly help. I've just downloaded and installed the ImageMagick-6.5.1-6-Q16-windows-dll.exe, seems like all the problems was resolved.

Even now, when I try the

convert -list configure

, the "gs" don't appear in the list. However, I can perfectly convert a.jpg and b.jpg into the multipage ab.pdf. The size of the final file is fantastic, as expected ;)

I don't have any other doubt at this moment, but I will back if any appears.

Once again, Thank you
Post Reply