Ping large amount of images

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
ivan.savu

Ping large amount of images

Post by ivan.savu »

Hi everybody,

I'm using Magick++ to obtain information about large number of very big images. I'm using ping method, from Magick::Image. My problem is that although I'm just pinging images, ImageMagick creates temporary files in temp folder, and after pinging large amount of files, I run out of space (Temp folder reaches 50GB). I tried limiting disk usage with MagickCore::SetMagickResourceLimit(MagickCore::DiskResource, 0); but then I get the "cache resource exhausted" exception. Is there any way I could disable caching ? Any help would be welcome.

Thanks, and please excuse my lousy English :).
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Ping large amount of images

Post by magick »

With most formats, pinging is lightweight. However, a few require that they first be cached to disk. Which image formats are you pinging? Can you post a small as possible Magick++ source code that illustrates the problem?
ivan.savu

Re: Ping large amount of images

Post by ivan.savu »

Thanks for quick reply :D.

I'm working with 1bit tiff files. Here's output of identify for one of them, they should all be of same size. There's around 700 of such images.

Code: Select all

a4b2.tif TIFF 9449x5906 9449x5906+0+0 1-bit Bilevel DirectClass 777kb 0.344u 0:01
identify.exe: incorrect count for field "DateTime" (11, expecting 20); tag ignored. `a4b2.tif'.
identify.exe: a4b2.tif: unknown field with tag 33550 (0x830e) encountered. `TIFFReadDirectory'.
identify.exe: a4b2.tif: unknown field with tag 33922 (0x8482) encountered. `TIFFReadDirectory'.
Here's a snippet of trimmed down code of what I'm doing:

Code: Select all

	for ( recursive_directory_iterator iter(imagesPath); iter != endIter; iter++ )
	{
		Magick::Image image_loader = Magick::Image();
                path image_file = iter->path();

		try
		{
			image_loader.ping(imageFile.string());
		}
		catch(...)
		{
 		       //Exception Handling...
		}
	}
while the loop executes ImageMagick creates large number of magick-* files in Temp directory. Each file is 213M big. This continues until I run out of space..
I ping each file exactly once, so I don't need to keep cache for all of them, any way I can achieve this ? Thanks.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Ping large amount of images

Post by magick »

We can reproduce the problem you posted and will have a fix for it in the ImageMagick Subversion trunk within a day or two. The patch will be available in the next point release as well. Thanks.
ivan.savu

Re: Ping large amount of images

Post by ivan.savu »

Thanks :) If there's anything I can do to help, just say it.
Post Reply