Page 1 of 1

Does stream read raw rgb files?

Posted: 2009-02-09T14:04:07-07:00
by wildbug
I'm running into a problem with reading raw rgb files output by the stream command back into it.

Essentially, stream uses all of my memory (32GB) in about 20 seconds trying to read a small (1.4MB) RGB file.

The command of interest is the second stream command below. The first just identifies the source file, the second removes a raw, RGB strip, and the third tries to read that strip via stream. The original raw RGB file, out.raw, is sucessfully readable via display or convert, FYI.

Code: Select all

$ time identify 18005.tif 
18005.tif TIFF 1543x1250 1543x1250+0+0 8-bit DirectClass 4.054mb 

real	0m0.006s
user	0m0.000s
sys	0m0.008s
$ time stream -map rgb -storage-type char -extract 1543x256+0+0 18005.tif out.raw

real	0m0.087s
user	0m0.080s
sys	0m0.008s
$ time stream -depth 8 -size 1543x256 -map rgb -storage-type char -extract 1543x128+0+0 rgb:out.raw out2.raw
(locks up and uses all available memory)
^C
$ time identify -depth 8 -size 1543x256 rgb:out.raw
(locks up and uses all available memory)
Using -debug All, after reading xml configuration files, this is repeated ad infinitum:

Code: Select all

2009-02-09T21:01:43+00:00 0:01 0.010u 6.4.8 Exception stream[29483]: stream.c/GetVirtualPixelStream/687/Exception
  Pixel cache is not open `out.raw'
What's going on here? Why does IM use all my memory? Why can't stream read in an rgb:file?

I'm using the following technique to process large files:
  1. Extract a strip with stream
  2. Pipe the raw RGB output to convert
  3. Do some processing
  4. Write a new raw RGB strip
After all the strips have been processed, I concatenate the ordered, raw RGB files back into a single file.

Re: Does stream read raw rgb files?

Posted: 2009-02-10T12:21:49-07:00
by magick
We have a patch for the problem you reported. Look for it in the ImageMagick Subversion trunk within the next day or two.

Re: Does stream read raw rgb files?

Posted: 2009-02-10T16:35:01-07:00
by wildbug
Cool, thanks.

In the meantime, I just realized I can use the "dd" command to read strips of raw RGB data.