Actually, that code is rather dated. An updated version might look like
this.
(Warning, not tested)
; grab-pixels :: BufferedImage -> [Integer]
(defn grab-pixels
"Returns an array containing the pixel values of the image"
[image]
(let [w (.getWidth image)
h (.getHeight image)
pixels (make-array (Integer/TYPE) (* w h))]
(.grabPixels (PixelGrabber. image 0 0 w h pixels 0 w))
pixels))
On Sun, Oct 4, 2009 at 3:52 AM, John Newman <[email protected]> wrote:
> I don't know much about it, but Yann N. Dauphin's Mona Lisa program might
> use what you're looking for: Clojure: Genetic Mona Lisa problem in 250
> beautiful
> lines<http://npcontemplation.blogspot.com/2009/01/clojure-genetic-mona-lisa-problem-in.html>
>
> Here's the relevant code:
>
>>
>> 1. ; grab-pixels :: BufferedImage -> [Integer]
>> 2. (defn grab-pixels
>> 3. "Returns an array containing the pixel values of image."
>> 4. [image]
>> 5. (let [w (. image (getWidth))
>> 6. h (. image (getHeight))
>> 7. pixels (make-array (. Integer TYPE) (* w h))]
>> 8. (doto (new PixelGrabber image 0 0 w h pixels 0 w)
>> 9. (.grabPixels))
>> 10. pixels))
>>
>>
>
> On Sat, Oct 3, 2009 at 10:20 PM, prishvin <[email protected]> wrote:
>
>>
>> Dear friends,
>>
>> I have some experience in lisp and now want to write a small program
>> in clojure.
>> The question is, how can I load a gray scale bitmap and how can i
>> access individual pixels in it.
>>
>> Thank you in advance.
>> M.Prishvin.
>>
>> >>
>>
>
>
> --
> John
>
--
John
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---