- Package:
- imagemagick-doc
- Source:
- imagemagick
- Submitter:
- Philipp Marek
- Date:
- 2010-03-01 09:42:12 UTC
- Severity:
- wishlist
Note: possibly related to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=275894. I'm trying to make an index picture of some photos, to have it printed along with them to have an easy overview. 66 JPEGs, totaling 140MB; most 3400x2300 pixel, some with 1.3 MPixel. Memory usage goes through the roof. First try was $ montage -label %f -background '#fff' -geometry +4+4 -resize 10% *-*.jpg index.jpg I'd have believed 140MB * 10% * 10% ~ 1.4MB; maybe times 100 while uncompressed in memory. Having 512MB real memory I thought that to be an easy task. But soon I had to kill that command; top shows 6960 flip 18 0 988m 271m 270m D 11.0 53.9 0:17.30 montage with all of swap and main memory used. Next I tried to convert the picture to a smaller size; thinking that it would then be ok. $ convert -geometry 100x100 '*-*.jpg' But that ate all memory, too. Only way was to do something along $ for a in *-*.jpg ; do convert $a -geometry 100x100 _$a; done $ montage -label %f -background '#fff' -geometry +4+4 _* index.jpg That worked. BTW, is there a way to tell imagemagick to respect the rotation tag, and possible sort the images by rotation? So that I get a row of portrait images, below a row with fewer landscape images, and so on - to fully utilize the given space? Thank you. Regards, Phil
Hi Philipp! With a new version of ImageMagick available on Debian (version 7:6.3.7.9.dfsg1-2, available on testing and unstable), do you still see the the memory usage problem that you reported on http://bugs.debian.org/349200, please? Thank you! Best regards, Nelson
Hello Nelson! Yes. It still happens. dpkg-query says: ii imagemagick 7:6.3.7.9.dfsg1-2 image manipulation programs 188MB in 85 JPEGs: $ montage -label %f -background '#fff' -geometry +4+4 -resize 10% *-*.jpg index.jpg gives PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 698 flip 20 0 713m 490m 488m D 10.0 52.0 0:07.06 montage Then I killed it. Can I help you in some other way? Regards, Phil
Hi Philipp! Hum... right. I think that one bug that I reported (http://bugs.debian.org/389604) is also related with it. I can see a big memory usage with display too. I have forwarded it to http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=10885 Lets see what upstream authors think about it. Thank you very much for your attention! Best regards, Nelson
Hi again! What they said is: ====== Add this to your command line to trade off memory usage for I/O usage: -limit memory 16mb -limit map 32mb. Another option is to build the 8-bit version of ImageMagick (add --with-quantum-depth=8 to the configure command line). The 8-bit version uses 100% less memory than the default 16-bit version. ====== I can see 5 times improvement in memory usage about bug 389604, by using "-limit memory 16mb -limit map 32mb". Could you try to use it and see if you get a satisfactory result, please? Thank you! Best regards, Nelson
$ montage -limit memory 16mb -limit map 32mb -label %f -background '#fff' -geometry +4+4 -resize 10% *-*.jpg index.jpg montage: invalid argument for option `16mb': -limit. In the documentation http://www.imagemagick.org/script/command-line-options.php#limit I see a reference to the "-list" option - but that doesn't work, too: $ montage -list resource montage: unrecognized option `-list'. $ montage -list list montage: unrecognized option `-list'. Any help?
Never mind; with a bit of experimenting I got it: $ montage -limit memory 16000000 -limit map 160000000 -label %f -background '#fff' -geometry +4+4 -resize 10% '*_*.jpg' index.jpg ... montage: unable to extend cache `20080216_150344.jpg': No space left on device. montage: unable to extend cache `20080217_015805.jpg': No space left on device. montage: unable to extend cache `20080217_015859.jpg': No space left on device. top said 8247 flip 20 0 203m 156m 152m D 17.3 16.6 0:04.74 montage So the 160M are taken ... but I don't get it to work.
Package: imagemagick Version: 7:6.3.7.9.dfsg1-2.1+lenny1 Tags: unreproducible According to upstream you are out of temp space. Also tags to unreproducible, because I can not reproduce on my laptop. I think we could close this bug report if you agree. Regards
I don't think so ... With 54 .jpgs in a directory, with (all together) 161MB disk usage, and 3M main memory/24G free disk space it still won't work with current: ii imagemagick 7:6.3.7.9.dfsg1-3 11514 flip 20 0 2795m 1.6g 1.6g R 23.0 60.2 0:27.94 montage Then I killed it, because the whole machine became unresponsive. That's a pity ... I just run this command: montage -label %f -background '#fff' -geometry +4+4 -resize 10% *_*.jpg index.jpg Well, it still doesn't work for me.
Ok will try your command surelly this week. Could you try before I will test some simple step? Could you try please to set MAGICK_TMPDIR to disk directory (for instance ~/tmp) ? Maybe imagemagick use shm filesystem (some admin set tmp dir to shm). Could you check that you have not enable quota (a lot of tool return disk full instead of overquota). Thank you for your report, Bastien
Doesn't help: 15886 flip 20 0 2308m 2.1g 2.1g R 6.8 79.9 0:22.04 montage But thank you for your answer! Regards, Phil
Hi! Can you run it with strace (and send us the output or put it online), please? Thank you! Best regards, Nelson
Here you are, hope that helps ... I killed it when it got to 2GB memory usage, and removed all read() calls after the first in each block. It just seems to allocate memory for all pictures ... Regards, Phil
Upstream asks to try this command:
montage -limit memory 0 -limit map 0 -label %f -background '#fff' -geometry +4+4 -resize 10% '*_*.jpg' index.jpg
Could you give a try?
Regards
Hello Bastien!
That gives me this:
montage: unable to extend cache `20080906_161736.jpg': No space left on device.
montage: unable to extend cache `20080906_161740.jpg': No space left on device.
montage: unable to extend cache `20080907_101831.jpg': No space left on device.
montage: unable to extend cache `20080913_132543.jpg': No space left on device.
montage: unable to extend cache `20080920_143251.jpg': No space left on device.
...
montage: unable to extend cache `20080904_144311.jpg': No space left on device.
montage: Memory allocation failed `20080904_144311.jpg'.
montage: unable to extend cache `20080904_144319.jpg': No space left on device.
montage: Memory allocation failed `20080904_144319.jpg'.
montage: unable to extend cache `20080906_151317.jpg': No space left on device.
montage: Memory allocation failed `20080906_151317.jpg'.
montage: unable to extend cache `20080906_161723.jpg': No space left on device.
montage: Memory allocation failed `20080906_161723.jpg'.
montage: unable to extend cache `index.jpg': No space left on device.
$ free
total used free shared buffers cached
Mem: 2771872 1360320 1411552 0 15448 373612
-/+ buffers/cache: 971260 1800612
Swap: 3678876 14792 3664084
$ LANG=C df -k .
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/md0 73299008 47880996 21694556 69% /
Thank you.
Regards,
Phil
I forgot to mention that it behaves much better; maximum memory usage is ~60MB: $ top -b | grep montage 10937 flip 20 0 58408 2916 2080 R 31.9 0.1 0:00.96 montage 10937 flip 20 0 58580 3096 2136 D 41.9 0.1 0:02.22 montage 10937 flip 20 0 58780 3300 2192 R 39.1 0.1 0:03.40 montage 10937 flip 20 0 58960 3496 2232 R 41.2 0.1 0:04.64 montage 10937 flip 20 0 59164 3672 2288 R 45.2 0.1 0:06.00 montage 10937 flip 20 0 59364 3884 2336 R 43.2 0.1 0:07.30 montage 10937 flip 20 0 59656 4208 2404 R 42.6 0.2 0:08.58 montage 10937 flip 20 0 59964 4496 2444 R 45.2 0.2 0:09.94 montage 10937 flip 20 0 60268 4776 2500 R 44.5 0.2 0:11.28 montage 10937 flip 20 0 60436 5040 2556 R 44.5 0.2 0:12.62 montage Sadly it doesn't work ;-( Regards, Phil
Could you please do a before montage MAGICK_TMPDIR=.; montage -limit memory 0 -limit map 0 -label %f -background '#fff' -geometry +4+4 -resize 10% '*_*.jpg' index.jpg and monitor disk space during the command run ? Could we BTW continue this dicussion directly upstream ? They are no value to continu here, because it is an upstream problem. and I do only copy and paste of your answer. please write on: http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=10885 Thank you
Ok; thank you. Do you monitor this thread for some solution, if there is any? Regards, Phil
Yes I have subsribed to the thread :) bastien
retitle 349200 Document that montage without -size is memory hungry
severity 349200 wishlist
thanks
This command work:
montage -label %f -background '#fff' -size 128x128 -geometry 128x128+4+4 '*_*.jpg' index.jpg
According to upstream:
Regards
Bastien