Re: [julia-users] Example of imread from an imagemagick stream

2015-05-18 Thread Yakir Gagnon
I’m now using open instead of readandwrite…
​


Yakir Gagnon
The Queensland Brain Institute (Building #79)
The University of Queensland
Brisbane QLD 4072
Australia

cell +61 (0)424 393 332
work +61 (0)733 654 089

On Fri, May 15, 2015 at 10:27 AM, Yakir Gagnon 12.ya...@gmail.com wrote:

 Thanks!
 OK, I finally found the commit you were talking about (commit
 7ba0d6093c093acfc5c1d71fa3cad1ff33bccdfc). I managed to find an example for
 the stuff I wanted:

 cmd = `convert $filename -depth $bitdepth $colorspace:-`
 stream, _ = readsfrom(cmd)
 nchannels = length(colorspace)
 data = read(stream, T, nchannels, sz...)

 But I couldn't find this mysterious readsfrom. I suspect it's something
 to do with OSX (I'm on linux). I blindly switched it with readandwrite on
 a complete whim. And it works!!!

 I'll be happy to know if this is sub-optimal.


 On Friday, May 15, 2015 at 12:08:01 AM UTC+10, Tim Holy wrote:

 If you dig through the commit history of Images.jl, at some point you'll
 find
 the commit that switched from using Cmd to the C api for interacting with
 ImageMagick. That should have quite a few examples.

 --Tim

 On Thursday, May 14, 2015 05:25:19 AM Yakir Gagnon wrote:
  Can someone please post a simple example of reading an image stream
 from
  imagemagick?
 
  So something like this (though this doesn't work):
 
  cmd = `convert img.png do some imagemagick things that I wish I could
 do
  with Images.jl but are only possible with imagemagick -compress none
 ppm:-`
  I = imread(readall(cmd),Images.PPMBinary)
 
  I'm trying to avoid writing the image imagemagick created to disk and
 read
  it straight into julia. The readall(cmd) part works awesome, it spews
 all
  the image bits to the stdout. But I can't get imread to pick it up as
 an
  image.
 
  Thanks in advance!




Re: [julia-users] Example of imread from an imagemagick stream

2015-05-14 Thread Tim Holy
If you dig through the commit history of Images.jl, at some point you'll find 
the commit that switched from using Cmd to the C api for interacting with 
ImageMagick. That should have quite a few examples.

--Tim

On Thursday, May 14, 2015 05:25:19 AM Yakir Gagnon wrote:
 Can someone please post a simple example of reading an image stream from
 imagemagick?
 
 So something like this (though this doesn't work):
 
 cmd = `convert img.png do some imagemagick things that I wish I could do
 with Images.jl but are only possible with imagemagick -compress none ppm:-`
 I = imread(readall(cmd),Images.PPMBinary)
 
 I'm trying to avoid writing the image imagemagick created to disk and read
 it straight into julia. The readall(cmd) part works awesome, it spews all
 the image bits to the stdout. But I can't get imread to pick it up as an
 image.
 
 Thanks in advance!



Re: [julia-users] Example of imread from an imagemagick stream

2015-05-14 Thread Yakir Gagnon
Thanks!
OK, I finally found the commit you were talking about (commit 
7ba0d6093c093acfc5c1d71fa3cad1ff33bccdfc). I managed to find an example for 
the stuff I wanted:

cmd = `convert $filename -depth $bitdepth $colorspace:-`
stream, _ = readsfrom(cmd)
nchannels = length(colorspace)
data = read(stream, T, nchannels, sz...)

But I couldn't find this mysterious readsfrom. I suspect it's something to 
do with OSX (I'm on linux). I blindly switched it with readandwrite on a 
complete whim. And it works!!!

I'll be happy to know if this is sub-optimal.


On Friday, May 15, 2015 at 12:08:01 AM UTC+10, Tim Holy wrote:

 If you dig through the commit history of Images.jl, at some point you'll 
 find 
 the commit that switched from using Cmd to the C api for interacting with 
 ImageMagick. That should have quite a few examples. 

 --Tim 

 On Thursday, May 14, 2015 05:25:19 AM Yakir Gagnon wrote: 
  Can someone please post a simple example of reading an image stream from 
  imagemagick? 
  
  So something like this (though this doesn't work): 
  
  cmd = `convert img.png do some imagemagick things that I wish I could 
 do 
  with Images.jl but are only possible with imagemagick -compress none 
 ppm:-` 
  I = imread(readall(cmd),Images.PPMBinary) 
  
  I'm trying to avoid writing the image imagemagick created to disk and 
 read 
  it straight into julia. The readall(cmd) part works awesome, it spews 
 all 
  the image bits to the stdout. But I can't get imread to pick it up as 
 an 
  image. 
  
  Thanks in advance!