Does stream read raw rgb files?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
wildbug
Posts: 21
Joined: 2008-06-18T12:53:24-07:00

Does stream read raw rgb files?

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Does stream read raw rgb files?

Post 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.
wildbug
Posts: 21
Joined: 2008-06-18T12:53:24-07:00

Re: Does stream read raw rgb files?

Post by wildbug »

Cool, thanks.

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