[Haskell] image writing library

Hal Daume III hdaume at ISI.EDU
Thu Aug 5 09:37:54 EDT 2004

another option is to use something like fly:


either through the text interface, or to link in.  i currently do the 
formet to create small graphs, pictures, etc.  not exceedingly efficient, 
but i don't know exactly your needs.

On Thu, 5 Aug 2004, Ketil Malde wrote:

> I think wxWindows is something I'll eventually have to look into, but
> it seems a bit heavy for my purposes at the moment.
> I discovered that although XPM accepts values in the range 0x00..0xff,
> it is still monochrome.  XGM (plain, that is, not raw) is
> approximately the same format, but displays the way I wanted.  So I
> ended up using:
>     mkpgm :: Array (Int,Int) Int -> String
>     mkpgm cm = header ++ "\n" ++ image
>         where header = unwords ["P2",show width,show heigth,show maxval]
>               image = unlines $ map show $ elems cm
>               (width,heigth) = snd $ bounds cm
>               maxval = maximum (elems cm)
> Not *very* beautiful, but seems to do the job for my stuff.  I'll try
> the PPM library if I need something a tad more fancy - like colors :-)
> Thanks for the suggestions!
> -ketil

 Hal Daume III                                   | hdaume at isi.edu
 "Arrest this man, he talks in maths."           | www.isi.edu/~hdaume

More information about the Haskell mailing list