[plt-scheme] Re: image manipulation

From: Robby Findler (robby at cs.uchicago.edu)
Date: Mon Mar 22 18:23:58 EST 2004

Maybe you're missing the set-scale method of dc<%>? Here's some example
code that scales the plt.jpg by 1/2 and saves it into ~/tmp.jpg:

(define src-bm (make-object bitmap% (build-path (collection-path "icons") "plt.jpg")))
(define scale-factor 1/2)
(define dest-bm (make-object bitmap% 
                  (ceiling (* scale-factor (send src-bm get-width)))
                  (ceiling (* scale-factor (send src-bm get-height)))))
(define dest-bdc (new bitmap-dc% (bitmap dest-bm)))
(send dest-bdc set-scale scale-factor scale-factor)
(send dest-bdc draw-bitmap src-bm 0 0)
(send dest-bm save-file "~/tmp.jpg" 'jpeg)

hth,
Robby

At Mon, 22 Mar 2004 22:57:12 +0000, Guenther Schmidt wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> Dear Robby,
> 
> thanks I had gotten that far but I don't see how I can do scaling though.
> 
> What am I missing?
> 
> Best regards
> 
> Günther
> 
> Robby Findler wrote:
> >   For list-related administrative tasks:
> >   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> > 
> > Yes. See bitmap% and bitmap-dc% in Help Desk.
> > 
> > Robby
> > 
> > At Mon, 22 Mar 2004 21:42:20 +0000, Guenther Schmidt wrote:
> > 
> >>  For list-related administrative tasks:
> >>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> >>
> >>Hi,
> >>
> >>does DrScheme have any support for manipulating images?
> >>
> >>For instance clipping a square out of a jpeg and scaling / shrinking it.
> >>
> >>Best regards
> >>
> >>Günther
> > 
> > 


Posted on the users mailing list.