PAID: Problem with IMagick, Huge temp files, LF a developer

Do you need consulting from ImageMagick experts and are willing to pay for their expertise? Or are you well versed in ImageMagick and offer paid consulting? If so, post here otherwise post elsewhere for free assistance.
AnavPT
Posts: 33
Joined: 2020-04-15T04:01:15-07:00
Authentication code: 1152

Re: PAID: Problem with IMagick, Huge temp files, LF a developer

Post by AnavPT »

I asked for the IM command,
under input PDF you mean a sample file?

If yes, look for "attachment": https://bugs.ghostscript.com/show_bug.cgi?id=702345

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

Re: PAID: Problem with IMagick, Huge temp files, LF a developer

Post by fmw42 »

He was asking for a PDF file that shows your behavior. Please provide that and your Imagemagick command that cause the large temp files so we can test your exact situation. Also provide your version of Ghostscript.

AnavPT
Posts: 33
Joined: 2020-04-15T04:01:15-07:00
Authentication code: 1152

Re: PAID: Problem with IMagick, Huge temp files, LF a developer

Post by AnavPT »

Where should I get the PDF file?

AnavPT
Posts: 33
Joined: 2020-04-15T04:01:15-07:00
Authentication code: 1152

Re: PAID: Problem with IMagick, Huge temp files, LF a developer

Post by AnavPT »

Currently I only have a cronjob command. I asked the hosting for the command they forwarded me to the developer which has limited support.

Eventually he will respond.

I'm posting GS version soon

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

Re: PAID: Problem with IMagick, Huge temp files, LF a developer

Post by fmw42 »

AnavPT wrote:
2020-04-18T11:17:36-07:00
Where should I get the PDF file?
Is that not your input file?

If not, then send an input image that causes the issue?

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: PAID: Problem with IMagick, Huge temp files, LF a developer

Post by snibgo »

@AnavPT: I am trying to reproduce your problem with large temporary files. It may be a combination of a PDF with large physical dimensions (in inches), with an IM command that rasterizes with a large density (1500 pixels per inch).

But I can only confirm this if you show the IM command, and PDF, that causes the problem.
snibgo's IM pages: im.snibgo.com

AnavPT
Posts: 33
Joined: 2020-04-15T04:01:15-07:00
Authentication code: 1152

Re: PAID: Problem with IMagick, Huge temp files, LF a developer

Post by AnavPT »

gs -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=pamcmyk32 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r1500x1500 -g54187x37500 -sOutputFile=/tmp/magick-25269EjNy90NAfnnR%d -f/tmp/magick-25269ENWpWU313ARs -f/tmp/magick-25269UQuoD7BLHow4

AnavPT
Posts: 33
Joined: 2020-04-15T04:01:15-07:00
Authentication code: 1152

Re: PAID: Problem with IMagick, Huge temp files, LF a developer

Post by AnavPT »

Here is a vector EPS 10 and large JPEG sample: (see: "attachment")
https://bugs.ghostscript.com/show_bug.cgi?id=702345

These are my input files

AnavPT
Posts: 33
Joined: 2020-04-15T04:01:15-07:00
Authentication code: 1152

Re: PAID: Problem with IMagick, Huge temp files, LF a developer

Post by AnavPT »

snibgo wrote:
2020-04-18T11:54:15-07:00
@AnavPT: I am trying to reproduce your problem with large temporary files. It may be a combination of a PDF with large physical dimensions (in inches), with an IM command that rasterizes with a large density (1500 pixels per inch).

But I can only confirm this if you show the IM command, and PDF, that causes the problem.
This makes sense. Look at the code (1500), and 36.13 in x 25 in is my eps file

AnavPT
Posts: 33
Joined: 2020-04-15T04:01:15-07:00
Authentication code: 1152

Re: PAID: Problem with IMagick, Huge temp files, LF a developer

Post by AnavPT »

Encapsulated postscript (EPS version 10) is the input file

AnavPT
Posts: 33
Joined: 2020-04-15T04:01:15-07:00
Authentication code: 1152

Re: PAID: Problem with IMagick, Huge temp files, LF a developer

Post by AnavPT »

Ok, where should I get to know the GhostScript version? My hosting wrote they are not running it

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

Re: PAID: Problem with IMagick, Huge temp files, LF a developer

Post by fmw42 »

What is your Imagick code? What is your version of Ghostscript? Your file converts fine for me on IM 6.9.11.6 Q16 Mac OSX. No temp files are left in /tmp.

Could the issue be with your Imagick or PHP?

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

Re: PAID: Problem with IMagick, Huge temp files, LF a developer

Post by fmw42 »

AnavPT wrote:
2020-04-18T13:21:29-07:00
Ok, where should I get to know the GhostScript version? My hosting wrote they are not running it
Imagemagick requires Ghostscript to process EPS/PS/PDF files. So if you are creating and output, then you must be using it and have it on your System.

What do you get from

Code: Select all

convert -version
Does it list gs or gslib in the Delegates?

If you have Ghostscript on your system and it is in the $PATH environment variable, then you should be able to type

Code: Select all

gs --version
and get the version


For example:

Code: Select all

convert -version
Version: ImageMagick 6.9.11-6 Q16 x86_64 2020-04-06 https://imagemagick.org
Copyright: © 1999-2020 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(3.1)
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib gvc jbig jng jp2 jpeg lcms lqr ltdl lzma openexr png ps raw rsvg tiff webp x xml zlib

Code: Select all

gs --version
9.50

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: PAID: Problem with IMagick, Huge temp files, LF a developer

Post by snibgo »

Okay, 36.13 * 25 inches, at 1500 pixels per inch, at 8 bytes per pixel, needs 16.3 GB. This is close to the size of your 19 GB temporary files.

You haven't showed your ImageMagick command. I suppose it has "-density 1500 -units PixelsPerInch".

So I suppose IM is doing what you tell it to do, and IM tells Ghostscript to rasterize the PDF with a huge number of pixels. I suspect your installation can't cope with such large files, and is killing the ImageMagick process.

If so, then the solution might be to ensure IM doesn't use large density numbers. Depending on your purpose, a very small density such as "-density=10" may be sufficient.
snibgo's IM pages: im.snibgo.com

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: PAID: Problem with IMagick, Huge temp files, LF a developer

Post by snibgo »

I should also mention: the limits we give IM apply only to IM, not to Ghostscript. For example, we might "-limit width 100" and this will prevent IM from reading output from Ghostscript that is wider than 100 pixels. But it won't prevent Ghostscript from creating a temporary file that is much wider.
snibgo's IM pages: im.snibgo.com

Locked