Different Machines, Different Results

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
howard39
Posts: 12
Joined: 2013-01-24T17:25:58-07:00
Authentication code: 6789

Different Machines, Different Results

Post 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?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Different Machines, Different Results

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
howard39
Posts: 12
Joined: 2013-01-24T17:25:58-07:00
Authentication code: 6789

Re: Different Machines, Different Results

Post 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?
howard39
Posts: 12
Joined: 2013-01-24T17:25:58-07:00
Authentication code: 6789

Re: Different Machines, Different Results

Post 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?
howard39
Posts: 12
Joined: 2013-01-24T17:25:58-07:00
Authentication code: 6789

Re: Different Machines, Different Results

Post 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?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Different Machines, Different Results

Post by anthony »

Older versions are on source forge.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Different Machines, Different Results

Post 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""/>
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Different Machines, Different Results

Post by glennrp »

anthony wrote:Older versions are on source forge.
Older *sources* are on SourceForge. Older *exes* aren't.
howard39
Posts: 12
Joined: 2013-01-24T17:25:58-07:00
Authentication code: 6789

Re: Different Machines, Different Results

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Different Machines, Different Results

Post 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.
snibgo's IM pages: im.snibgo.com
howard39
Posts: 12
Joined: 2013-01-24T17:25:58-07:00
Authentication code: 6789

Re: Different Machines, Different Results

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Different Machines, Different Results

Post 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.
snibgo's IM pages: im.snibgo.com
howard39
Posts: 12
Joined: 2013-01-24T17:25:58-07:00
Authentication code: 6789

Re: Different Machines, Different Results

Post 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.
Post Reply