Not sure what is going on. If mogrify chooses to create a full 32 bit representation (RGB + Alpha at 8 bit each), then you could be up for 15 597 * 8 864 * 4 = 553 007 232 bytes or 11 757 * 8 376 * 4 = 393 906 528 bytes for the first and second respectively. This isn't isgnificant, though you have said you have 2Gb of RAM.
You may have crossed an image size boundary that means mogrify that causes it use a different enumeration algoithm - who knows? As alternative, I tried using the netpbm tools (an alternative, some would say clunkier) alternative to imagemagick. When trying pnmflip -rotate90 on a 15597x8864 it choked with "out of memory allocating an array" :-( As you are rotating a whole 90 degrees, one technique that might be more memory efficient is to divide the rotate problem up. I'll try scripting it momentarily but you could 1. Divide the image into, say, a 4 x 4 grid of sub-images. 2. Rotate each sub-image independently 3. Then reassemble the sub-images into a whole (obviously in the right order) That way you only need to store an image 1/16 of the whole at any one time Martin On Sun, Apr 20, 2008 at 3:32 PM, Michael Lake <[EMAIL PROTECTED]> wrote: > Hi all > > I'm having problems in using Imagemagick to rotate some tiff images. > I'm using this command: mogrify -monitor -rotate -90 0088.tif > > It's taking about 4 hours for a few images like this one: > > $ identify 0088.tif > 0088.tif TIFF 15597x8864, 435kb 2.710u 0:14 > > $ tiffinfo 0088.tif > Image Width: 15597 Image Length: 8864 > Resolution: 300, 300 pixels/inch > Compression Scheme: CCITT Group 4 > Rows/Strip: 8864 > > But this one takes just 30 seconds! > $ identify 0087.tif > 0087.tif TIFF 11757x8376, 498kb 1.150u 0:02 > > $ tiffinfo 0087.tif > Image Width: 11757 Image Length: 8376 > Resolution: 300, 300 pixels/inch > Bits/Sample: 1 > Compression Scheme: CCITT Group 4 > Rows/Strip: 8376 > > Both are similarly sized images. What's happening with the slow ones is that > the > hard disk stays on continuosuly like its using swap a lot but I'm not really > sure. Looking at top when the process is running shows that occasionally the > process status is 'R' for running but most often its 'D' for uninterruptable > sleep. > > $ vmstat > procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu---- > r b swpd free buff cache si so bi bo in cs us sy id wa > 0 3 0 52924 10220 1917260 0 0 196 3162 339 65 0 5 38 > 57 > ;casteret: /home/mikel~$ > > Example of top showing mogrify in 'D' state: > > top - 13:09:27 up 27 min, 3 users, load average: 3.58, 3.29, 2.57 > Tasks: 85 total, 1 running, 84 sleeping, 0 stopped, 0 zombie > Cpu(s): 0.0%us, 2.0%sy, 0.0%ni, 49.8%id, 46.3%wa, 0.5%hi, 1.3%si, > 0.0%st > Mem: 2067444k total, 2014736k used, 52708k free, 10820k buffers > Swap: 2097144k total, 0k used, 2097144k free, 1916280k cached > > PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND > 3543 mikel 18 0 13976 5768 2548 D 4 0.3 1:37.27 mogrify > 1146 root 10 -5 0 0 0 D 0 0.0 0:03.42 kjournald > 3052 root 16 0 1812 620 536 S 0 0.0 0:00.73 hald-addon-stor > 1 root 15 0 1944 636 544 S 0 0.0 0:01.53 init > 2 root RT 0 0 0 0 S 0 0.0 0:00.00 migration/0 > 3 root 34 19 0 0 0 S 0 0.0 0:00.00 ksoftirqd/0 > > Example of top showing mogrify in 'R' state: > > top - 13:11:21 up 29 min, 3 users, load average: 3.39, 3.36, 2.68 > Tasks: 85 total, 2 running, 83 sleeping, 0 stopped, 0 zombie > Cpu(s): 0.2%us, 1.7%sy, 0.0%ni, 47.3%id, 48.0%wa, 1.0%hi, 1.8%si, > 0.0%st > Mem: 2067444k total, 2015712k used, 51732k free, 11092k buffers > Swap: 2097144k total, 0k used, 2097144k free, 1917764k cached > > PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND > 3543 mikel 18 0 13976 5768 2548 R 3 0.3 1:40.86 mogrify > 744 root 10 -5 0 0 0 S 0 0.0 0:00.06 ata/0 > 1146 root 10 -5 0 0 0 D 0 0.0 0:03.70 kjournald > 3470 root 30 15 3744 2184 692 S 0 0.1 0:01.26 preload > 1 root 15 0 1944 636 544 S 0 0.0 0:01.53 init > > Imagemagic tools can have the limited set for memory and I have checked that > it > is using whats available. I have 2G RAM. > > $ mogrify -list resource > File Area Memory Map Disk > ------------------------------------------------ > 768 1010.0mb 1.97gb 3.95gb 4.000eb > > > I have tried setting nice to -20 for this process but it does not make much > difference if at all to the running time. > I have also killed of lots of daemons that were eating resources. > > Questions: > What is 'uninterruptable sleep' ? > Anyhow pointers on how I can speed things up. > Why oh why might a few dozen images / 200 take so long when others take 30 > seconds? > > Mike Lake > > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html > -- Regards, Martin Martin Visser -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html