Convert PDF to PNG Issues

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
ejkarthik
Posts: 3
Joined: 2014-01-21T09:45:33-07:00
Authentication code: 6789

Convert PDF to PNG Issues

Post by ejkarthik »

Hi All,

ImageMgaick Version: 6.2.8
OS: x86_64-red hat linux-gnu

I am using a sample java api which is used to convert image from PDF to PNG Format,my code is working fine in Dev and Test Environments which is a simple server and conversion happened properly for all the images(PDF ->PNG) respectively , but the issue i am facing is on Stage Environment consist of 2 servers and image magick-6.2.8 has been installed on 2 servers and code is also executing on 2 servers,but the problem i am facing is the images are not coming with full clarity (i.e half of the images are coming) and for some of the pdf's i am getting an exception from the code "Malformed Input Exception".

Please, it would be helpful if anyone provide any suggestions or any ideas on this.

Below is my sample java api code.

IMOperation img = new IMOperation();
img.addImage();
img.addImage();

ConvertCmd convert = new ConvertCmd();

convert.run(img, new Object[] { inputImagePath.getAbsolutePath(), outputImagePath.getAbsolutePath() });

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

Re: Convert PDF to PNG Issues

Post by fmw42 »

I know nothing about your API, but IM 6.2.8 is ancient (over 600 versions old). Can you upgrade?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert PDF to PNG Issues

Post by fmw42 »

IM uses Ghostscript to process pdf files. Is ghostscript installed? Does IM know about it?

check

convert -list configure

and look at the line starting with Delegates. Is gs or gslib listed?

Also PNG does not support CMYK. So if your PDF is CMYK, then you need to convert to sRGB first.
ejkarthik
Posts: 3
Joined: 2014-01-21T09:45:33-07:00
Authentication code: 6789

Re: Convert PDF to PNG Issues

Post by ejkarthik »

Thanks for the quick response Sir,

For your 1st question ,

Yes as you said its correct for PDF's Conversion Ghost Script required, i have installed GhostScript Version: 8.70 in both the servers.

and delegate is configured as --with-gslib is been listed.

For your 2nd question ,

The version is old but this is the one which is been installed in Dev and Test Environments and its been tested where all the conversions are been working fine, the problem persists in Stage which is 2 server been configured.

and moreover its a Java Api which i have used and been referred from the below link,

http://im4java.sourceforge.net/docs/dev-guide.html

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

Re: Convert PDF to PNG Issues

Post by fmw42 »

I know nothing about java. So I cannot help. But does the java see the ghostscript?

Second, just because your configure file lists --with-gslib, does not mean that IM sees it after being compiled. The only way to know for sure is to check

convert -list configure

and see if it is listed in the line starting with Delegates as gs or gslib

or

convert -list format

and see if it is listed as rw+

PDF PDF rw+ Portable Document Format

or

look in your config.log file and see if it shows there towards the bottom as

Ghostscript lib --with-gslib=yes yes
ejkarthik
Posts: 3
Joined: 2014-01-21T09:45:33-07:00
Authentication code: 6789

Re: Convert PDF to PNG Issues

Post by ejkarthik »

Java Make use of the Ghost Script in order to do the conversion and i have installed that too.

But the problem here is one environment its working fine but in another environment its not..and its installed with same versions and same configurations, and moreover as you said i have used the command "convert -list configure" and the delegates is configured as --with-gslib and also for format its +rw mode.

So can you tell me few other possible solutions which would be helpful for me please.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert PDF to PNG Issues

Post by fmw42 »

I do not think I can help much more. I still suspect that your java is not properly finding ghostscript.

what do you get from your java by issuing the command equivalent of

convert -list configure

and see if it is listed in the line starting with Delegates as gs or gslib
Post Reply