Composite creates huge files

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?".
energee

Composite creates huge files

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Composite creates huge files

Post by magick »

energee

Re: Composite creates huge files

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Composite creates huge files

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

Re: Composite creates huge files

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

Re: Composite creates huge files

Post 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!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Composite creates huge files

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

Re: Composite creates huge files

Post 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?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Composite creates huge files

Post 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-).
energee

Re: Composite creates huge files

Post 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/
energee

Re: Composite creates huge files

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

Re: Composite creates huge files

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Composite creates huge files

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

Re: Composite creates huge files

Post by energee »

Here are two more images, explaining what happens:


Image

Image
energee

Re: Composite creates huge files

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