Re: [Haskell] Image manipulation

[redirecting to haskell-cafe]
On 10/29/07, Brent Yorgey
Haskell is a wonderful language, so I hate to say this...but personally I don't see the benefit of using Haskell here, unless the manipulations you want to do are very complex. Some simple shell (or perl/python/ruby/whatever) scripts to glue together some calls to convert (or possibly other ImageMagick utilities) ought to do the job just fine.
If you're doing many image transformations, invoking an external program like convert will get expensive due to context-switching. So that's why something like the (not-yet-existent) bindings for ImageMagick-as-a-library might be useful. I agree that laziness probably isn't going to be helpful, but there may be interesting things to be done that are enabled by purity and higher-order-functions. I'm working on the ImageMagick bindings because I'm curious to find out. There are obvious things like being able to define compositions of transformations -- which is easy to do when you're calling library functions in-memory, and less so if you're using a separate executable -- but maybe there are more interesting applications too. Cheers, Tim -- Tim Chevalier * catamorphism.org * Often in error, never in doubt "Thus spake the Master Programmer: When you have learned to snatch the error code from the trap frame, it will be time for you to leave."--J. Geoffrey

On Mon, Oct 29, 2007 at 02:39:58PM -0700, Tim Chevalier wrote:
[redirecting to haskell-cafe] On 10/29/07, Brent Yorgey
wrote: Haskell is a wonderful language, so I hate to say this...but personally I don't see the benefit of using Haskell here, unless the manipulations you want to do are very complex. Some simple shell (or perl/python/ruby/whatever) scripts to glue together some calls to convert (or possibly other ImageMagick utilities) ought to do the job just fine.
If you're doing many image transformations, invoking an external program like convert will get expensive due to context-switching. So that's why something like the (not-yet-existent) bindings for ImageMagick-as-a-library might be useful.
I agree that laziness probably isn't going to be helpful, but there may be interesting things to be done that are enabled by purity and higher-order-functions. I'm working on the ImageMagick bindings because I'm curious to find out. There are obvious things like being able to define compositions of transformations -- which is easy to do when you're calling library functions in-memory, and less so if you're using a separate executable -- but maybe there are more interesting applications too.
The OP specified that the images are around 5M in size, and need to be rescaled, so we're talking about quite a bit of computation per shellout (tens to hundreds of megacycles). Are context switches that slow? Stefan

On 10/29/07, Stefan O'Rear
The OP specified that the images are around 5M in size, and need to be rescaled, so we're talking about quite a bit of computation per shellout (tens to hundreds of megacycles). Are context switches that slow?
I don't know. I'd have to do the experiment before I could give an answer to that. But yeah, if I were the OP, I would probably start by trying to write a shell script (or a simple Haskell program with calls to "system") to do what I wanted, and see if that was adequate. Cheers, Tim -- Tim Chevalier * catamorphism.org * Often in error, never in doubt "Work a little bit harder on improving your low self-esteem, you stupid freak" -- "Weird Al" Yankovic
participants (2)
-
Stefan O'Rear
-
Tim Chevalier