Page 1 of 1
Split huge image file without reading entire file
Posted: 2012-01-23T12:24:06-07:00
by danc81
I have a file which is around 100000 x 100000 pixels, I would like to crop into smaller images which I'm doing with:
convert input.jpg -crop 100x100 +repage output_%d.jpg
This is working but it takes a very long time and a huge amount of memory to open the file. Is there a way to do this without opening the entire file first?
Re: Split huge image file without reading entire file
Posted: 2012-01-23T12:30:41-07:00
by fmw42
I am not an expert on large image processing. All I can do is refer you to
http://www.imagemagick.org/Usage/files/#massive
Re: Split huge image file without reading entire file
Posted: 2012-01-25T04:46:16-07:00
by danc81
Thanks, I've been reading through that and adjusting memory limits etc but it still takes a very long time (10 mins+) to open the file whereas something like GIMP can open it and start processing in < 10 secs. Not sure if this is expected or if I'm doing something wrong.
Re: Split huge image file without reading entire file
Posted: 2012-01-25T21:01:25-07:00
by anthony
Gimp uses a caching method that allow part of an image to be in memory.
IM "stream" command can read an image one row at a time and process the image, but is really limited to 'cropping' one section only.
PBMplus should be able to do stream processing, but little in the way of non-source documentation exists for this aspect, and only works with its own internal image file formats.
Ideally we want a 'stream' image processor that can not only split up an image into tiles, but also re-join tiles back into a large image.
The latter aspect seems to be less thought about, but just as nessary!