shiro #1856(2007/08/05 03:37 GMT) [ Scheme ] Rating2/2=1.00
Gauche-gd ( http://fixedpoint.jp/gauche-gd/ ) を使ってみました。 実行例: gosh> (get-and-invert-jpeg "practical-scheme.net" "/images/practical-scheme-icon.jpg" "t.jpg")
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
(use graphics.gd) (use rfc.http) (use srfi-42) (define (get-and-invert-jpeg host path output) (receive (status hdrs body) (http-get host path) (unless (equal? status "200") (error "http-get failed:" status)) (let1 img (read-gd-image (open-input-string body) 'jpg) (do-ec (: x (gd-image-sx img)) (: y (gd-image-sy img)) (let1 pixel (gd-image-get-pixel img x y) (gd-image-set-pixel img x y (gd-true-color (- 255 (gd-image-red img pixel)) (- 255 (gd-image-green img pixel)) (- 255 (gd-image-blue img pixel)))))) (call-with-output-file output (cut write-as img 'jpg <>)))))
Rating2/2=1.00-0+
[ reply ]
shiro
#1856()
[
Scheme
]
Rating2/2=1.00
Rating2/2=1.00-0+
[ reply ]