Hello all, I'm having some trouble processing a block of pixels from an image. I want to grab some portion of image, do something to it, and save it to a file. In this example, I grab a portion of an image and save it to a file but the image in the file is corrupted. Evidently I'm doing something wrong. I've spent a number of hours trying to figure it out, but I'm blind to the problem. I would be very grateful for any help someone can give me.
Sincerely, Dan Anderson #lang racket/gui ; define the portion of the image I want to process (define x 0) (define y 0) (define w 10) (define h 10) (define bm (make-object bitmap% "4colors.jpg")) (define pixels (make-bytes (* w h 4) 0)) ;each pixel has four numbers (send bm get-argb-pixels x y w h pixels true) ; get the block of pixels pixels ;check that there is information in pixels ;make a new bitmap of the section (define nbm (make-object bitmap% pixels w h)) (send nbm save-file "test.png" 'png) _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users