Ah, you should read the first line from the stream first. The stream reader 
starts after the magic bytes. See here for information about the format:
http://en.wikipedia.org/wiki/Netpbm_format

--Tim

On Monday, May 12, 2014 11:54:43 PM Yakir Gagnon wrote:
> Thanks for the quick replay!
> I'm sure this error has to do with the problematic NEF format, but just in
> case it doesn't, here's the error output:
> 
> I = imread(readsfrom(`dcraw -c "SHT_0001.NEF"`)[1],Images.PPMBinary)
> ERROR: ArgumentError("'P' is not a valid digit (in \"P6\")")
>  in parseint at string.jl:1459
>  in parseints at /home/yakir/.julia/v0.2/Images/src/io.jl:756
>  in parse_netpbm_size at /home/yakir/.julia/v0.2/Images/src/io.jl:455
>  in imread at /home/yakir/.julia/v0.2/Images/src/io.jl:465
> 
> I'll just add that it is probably possible to add NEF functionality to
> imagemagick and therefore indirectly to imread as well. So that's one
> option.
> 
> On Tuesday, May 13, 2014 11:24:03 AM UTC+10, Tim Holy wrote:
> > You'll probably have more luck with `readsfrom` than `readall`.
> > 
> > --Tim
> > 
> > On Monday, May 12, 2014 04:34:14 PM Yakir Gagnon wrote:
> > > I have a bunch of NEF images that I need to do some calculations with. I
> > > could just convert and save them all to some normal format with dcraw,
> > 
> > but
> > 
> > > that will just take disk-space. I'd rather read them into Julia somehow.
> > > dcraw has an option to output the image to the pipe (dcraw -c filename),
> > 
> > so
> > 
> > > I thought that since Images.jl's imread can read streams, maybe I can
> > 
> > get
> > 
> > > it to work that way. Something along the lines of:
> > > 
> > > I = imread(readall(`dcraw -c "SHT_0001.NEF"`),PPMBinary())
> > > 
> > > But this doesn't work. Any ideas?

Reply via email to