On Tue, Aug 10, 2010 at 5:00 PM, Raul Miller <[email protected]> wrote:
> So... I use gethttp to retrieve a png image which I want to manipulate in J.
>
> png=:gethttp'http://rosettacode.org/mw/images/c/c6/Pentagon.png'
>
> What is the simplest way to convert that raw data to an array of pixel
> values?

The simplest way is using imagemagick.  Try this:

   img=: 240 320 $ a.i. 2!:0 'curl
"http://rosettacode.org/mw/images/c/c6/Pentagon.png"; | convert -
gray:-'
   '.@'{~ (<(+/%#)@:,) _10+/\"1] _10+/\ img

Ambrus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to