Page 1 of 2

Composite creates huge files

Posted: 2008-03-12T20:18:24-07:00
by energee
Hello,

I have been trying to use composite.exe to add watermarks to some of my images delivered from a specific location on apache.

I have used the following:

<IfModule mod_ext_filter.c>
ExtFilterDefine watermark mode=output intype=image/jpeg cmd="C:/ImageMagick/composite.exe -gravity Center -quality 60 -watermark 20.0 D:/www/************.com/public/images/logo-watermark.png - -"
</IfModule>

However, when i start apache and try to see the images, they look ok but imagemagick creates some huge (sometimes 2-3GB) files on C:\ with filenames like magick-404545 (no file extension)
These files are huge and it creates many of them. As a result, my server's performance drops very low and the drive C:\ gets full.

I have no idea why this happens.

Any idea?

Thanx!
Al.

Re: Composite creates huge files

Posted: 2008-03-13T06:20:39-07:00
by magick

Re: Composite creates huge files

Posted: 2008-03-13T06:29:27-07:00
by energee
I read that article.
However, it still does not explain why i get HUGE files that fill up my 250GB disk, when i only use composite.exe to watermark JPEG images of about 100-200kb.

Re: Composite creates huge files

Posted: 2008-03-13T06:34:24-07:00
by magick
Lets look for a file leak. Clean up your temporary disk area of all magick-* files. Next run your composite command from a Command Prompt windows. When it complete see if there are any new magick-* files left over in your temporary disk area. If so that might indicate a bug in ImageMagick.

Re: Composite creates huge files

Posted: 2008-03-13T06:45:53-07:00
by energee
I tried that.

But my command in apache is:


"C:/ImageMagick/composite.exe -gravity Center -quality 60 -watermark 20.0 D:/www/************.com/public/images/logo-watermark.png - -"

And i use this command along with:

<Directory "D:\www\**********.com\public\images\stories\jreviews">
SetOutputFilter watermark
</Directory>

So there's no way to do the same from a Command Prompt box.
However, i just executed the command with 1 test JPEG file of about 150kb and the result image was generated instantly. No magick- files were created on my disk.

Re: Composite creates huge files

Posted: 2008-03-13T06:49:11-07:00
by energee
BTW,

The directory "D:\www\**********.com\public\images\stories\jreview" where i want my images to include watermark, contains 3.200 images, with total disk space 398mb.

Those are normally accessed from apache every 10 seconds or so (it's a high-traffic website)

Thanx!

Re: Composite creates huge files

Posted: 2008-03-13T06:53:51-07:00
by magick
Good, no file leak. Another possibility is that the some of your composite commands are aborting before they complete. ImageMagick captures some signals and attempts to clean up any temporary files however not all signals can be caught.

Re: Composite creates huge files

Posted: 2008-03-13T16:11:24-07:00
by energee
magick wrote:Good, no file leak. Another possibility is that the some of your composite commands are aborting before they complete. ImageMagick captures some signals and attempts to clean up any temporary files however not all signals can be caught.
Yes actually that sounds possible.
Any idea how to solve this?

Re: Composite creates huge files

Posted: 2008-03-13T16:47:54-07:00
by magick
Sure, either discover the reason the composite program is aborting and fix it so the program completes and removes all its temporary files or run a periodic script that removes all temporary files that are left behind (they always start with the prefix magick-).

Re: Composite creates huge files

Posted: 2008-03-13T16:57:47-07:00
by energee
I found this on the apache error log:

[Fri Mar 14 01:57:19 2008] [client xxx.xx.xx.xx] mod_ext_filter (22)Invalid argument: utf8 to ucs2 conversion failed on this string: HTTP_REFERER=http://www.***********.com/component/option,com_jreviews/task,list/jr_area,ÊïõêÜêé/cat,42/Itemid,256/
[Fri Mar 14 01:57:19 2008] [error] [client xxx.xx.xx.xx] (22)Invalid argument: couldn't create child process to run `C:/ImageMagick/composite.exe', referer: http://www.*****.com/component/option,com_jreviews/task,list/jr_area,\xca\xef\xf5\xea\xdc\xea\xe9/cat,42/Itemid,256/

Re: Composite creates huge files

Posted: 2008-03-13T17:07:08-07:00
by energee
Right now, i can see 4 instances of "composite.exe" on the task manager.
They wont go away, and those are probably the ones that fill up the disk.

Re: Composite creates huge files

Posted: 2008-03-13T17:14:07-07:00
by energee
Here's an image i just got when trying to access an image on that directory.

I have blurred out the watermark logo on the center.

Image

Re: Composite creates huge files

Posted: 2008-03-13T17:28:53-07:00
by magick
You should be able to run the task manager and kill the run away composite jobs.

Add -limit memory 16 -limit map 64 to your composite command line to ensure no one job consumes all the available memory. Also make sure you have a modern release of ImageMagick. The current version if 6.3.9-7.

Re: Composite creates huge files

Posted: 2008-03-13T17:36:31-07:00
by energee
Here are two more images, explaining what happens:


Image

Image

Re: Composite creates huge files

Posted: 2008-03-13T17:38:32-07:00
by energee
magick wrote:You should be able to run the task manager and kill the run away composite jobs.
No actually i can't. They don't get killed.
magick wrote: Add -limit memory 16 -limit map 64 to your composite command line to ensure no one job consumes all the available memory. Also make sure you have a modern release of ImageMagick. The current version if 6.3.9-7.
I do have the latest version.
Let me try that