Page 1 of 1

Different Machines, Different Results

Posted: 2013-02-12T18:59:11-07:00
by howard39
On my development system (Windows 7) I have installed ImageMagick-6.8.1-Q16 and Ghostscript 9.06 (64 bit). The following command

Code: Select all

"C:\Program Files (x86)\ImageMagick-6.8.2-Q16\convert.exe" -density 300 "c:\temp\Bush.pdf" -threshold 15% -type bilevel "c:\temp\Test00.pdf"
converts a 337KB pdf file containing a single scanned page in greyscale to a 297 KB file in black and white, in 10 sec and grabbing 16 MB of memory.

But on a server (Windows 2008 Server) with the same 2 programs installed, the same command converts the 337KB pdf file to a 4,157 KB file in black and white, in 2 minutes and eventually grabbing almost 1 GB of memory. In a PDF viewer, the result looks the same as the desktop results.

Changing the command to

Code: Select all

"C:\Program Files (x86)\ImageMagick-6.8.2-Q16\convert.exe" -density 300 "c:\temp\Bush.pdf" -threshold 15% -type bilevel -compress fax "c:\temp\Test00.pdf"
compresses the file, in both cases, by about a factor of 10 without adding noticeable execution time or memory usage.

How can I get Imagick to work on the server the same way it works on my desktop system?

Re: Different Machines, Different Results

Posted: 2013-02-12T21:13:21-07:00
by anthony
Note that IM does not read (or understand) pdf itself. but uses ghostscript to convetr that to an image.
Your ghostscript versions may be different.

Same goes or other image file libraries like jpg and png. The two OS's will likely have different versions as part of the system updates.

Re: Different Machines, Different Results

Posted: 2013-02-13T13:13:33-07:00
by howard39
Well, I installed Ghostscript and Imagemagick myself from copies of the same installation files.

What can I do to track down the problem?

Re: Different Machines, Different Results

Posted: 2013-02-13T14:23:27-07:00
by howard39
Contrary to what I said above, it turns out that I had different versions of IM on my desktop machine and my server. The one on my desktop machine (that gave good results) was ImageMagick-6.8.1-Q16. The one on the server (which gives "bad" results, i.e. a 10X larger output file) is ImageMagick-6.8.2-Q16.

On my desktop machine, I uninstalled ImageMagick-6.8.1-Q16 and installed ImageMagick-6.8.2-Q16. Now the desktop results are "bad" just like the server results (as described in my original post).

Unfortunately I do not have an ImageMagick-6.8.1-??-Q16-x86-dll.exe file that I could use to install the old, good version on the server to see if this "fixes" the problem.

How can I get a copy of ImageMagick-6.8.1-??-Q16-x86-dll.exe? Or can you reproduce and fix a problem created in the upgrade from 6.8.1 to 6.8.2?

Re: Different Machines, Different Results

Posted: 2013-02-13T17:58:19-07:00
by howard39
It looks like I was dealing with a multipage document where 6.8.1 was converting only the first page (hence the small output file size) and 6.8.2 was correctly processing all the pages.

Can you get me the 6.8.1 install file so I can research this further?

Re: Different Machines, Different Results

Posted: 2013-02-13T19:57:09-07:00
by anthony
Older versions are on source forge.

Re: Different Machines, Different Results

Posted: 2013-02-13T21:52:01-07:00
by fmw42
Note you may have difference in the delegates.xml files. I believe that PDF files with multiple pages and transparency cannot simultanously be processed with IM and Ghostscript. You need to set the sDEVICE to pngalpha to process a single page with transparency or pnmraw for multiple pages without transparency.

see delegates.xml


<delegate decode="ps:alpha" stealth="True" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pnmraw" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>

Re: Different Machines, Different Results

Posted: 2013-02-14T03:57:15-07:00
by glennrp
anthony wrote:Older versions are on source forge.
Older *sources* are on SourceForge. Older *exes* aren't.

Re: Different Machines, Different Results

Posted: 2013-02-14T08:31:51-07:00
by howard39
fnmw42 -- I made the change in delegates.xml that you suggested, but the behavior didn't change. I'm getting all 14 pages of the document whether the setting is pngalpha or pnmraw.

Re: Different Machines, Different Results

Posted: 2013-02-14T08:47:29-07:00
by snibgo
I probably can't help, but I am confused. What problem are you trying to solve?

If you put the PDF somewhere public, and provide the URL here, we can experiment.

Re: Different Machines, Different Results

Posted: 2013-02-14T09:06:05-07:00
by howard39
The problem is that, under a condition that I can't currently reproduce, compressing the pdf with IM failed because it only copied the first page of a multipage pdf. I'm worried that, unless I understand what happened, it could happen again.

You should be able to access the files at

https://dl.dropbox.com/u/173206/Bush.pdf
https://dl.dropbox.com/u/173206/temp00.pdf

Re: Different Machines, Different Results

Posted: 2013-02-14T10:21:33-07:00
by snibgo
I can reproduce a problem, which seems to be fixed in 6.8.3-0. On Windows 7, testing with IM 6.7.9-6, 6.8.1-10, 6.8.2-0 and 6.8.3-0:

In all four IM versions, "identify" says Bush.pdf has 14 pages. With Adobe Reader, I can see 14 pages, each with a single raster image. They are very similar, but only the letter on the first page is addressed to "American Airlines Center".

For the command ...

Code: Select all

convert Bush.pdf b.png
... 6.7.9-6 and 6.8.3-0 both make 14 png files, as expected. However, 6.8.1-10 and 6.8.2-0 each make only one png file, the first page. Interestingly, I can convert individual pages. For example ...

Code: Select all

"%IMG682%convert" Bush.pdf[10] b-10.png
... works fine.

I suggest you upgrade to 6.8.3-0 and see if that helps.

Re: Different Machines, Different Results

Posted: 2013-02-14T11:59:05-07:00
by howard39
Strange, for me 6.8.2-0 makes 14 png files. And presumably 6.8.-0 was making 1 png file.

It's encouraging that you found that an old versin only converted 1 file.