Re: Importing a large image...
- To: mathgroup at smc.vnet.net
- Subject: [mg98595] Re: Importing a large image...
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Mon, 13 Apr 2009 03:37:23 -0400 (EDT)
- References: <grpiih$lqm$1@smc.vnet.net>
David Reiss wrote: > So, my fellow denizens of the group. > > I have a very large TIFF image--roughly 700MB in size. > > Its dimension are 43201 by 15601. It is single color with a bit depth > of 8. > > Mathematica is unable to Import this file on my 6 GM RAM powerbook > without maxing out the memory. > > I actually do not need to read in the whole file: I'd be happen with > being able to break the file into a number of smaller TIFFs which tile > it completely and then process each on independently (I am needing to > act on the data in various ways to yield a processed result for > further analysis down the line). This is all for a larger project > for a consulting client of mine. > > Any suggestions for how to programmatically carve up the image without > having to completely read it in first? I am looking for quick > solutions rather than ones that require a lot of programming. Either > it can be done pretty simply, or (more likely) Mathematica chokes on > these very large files. > > (Photoshop, on the other hand, does not choke on it at all, nor do > some other programs that are optimized for image analysis such as ENVI > (http://www.ittvis.com/ProductServices/ENVI.aspx): but I don't want to > work with these... nor do I have them....) Naturally, Mathematica can't be good for any task. Sometimes you have to use other programs too :) So I'd recommend trying ImageMagick's convert tool: http://www.imagemagick.org/ convert -crop 200x200 yourfile.tiff out%d.png will break the image into 200x200 pixel tiles. Now I can't guarantee that it won't run out of memory, and I did have trouble with the TIFF files ImageMagick generated in the past (that's why I used PNG as the output in the example), but it's certainly worth a try. > > Of course this leads to a suggestion for the Import function: to allow > reading in only a part of an image at a time. > > Feel free to respond to the list, but also CC me on the replies so > that I get them sooner than the usual turnaround. >