Hi all,

Does anyone know how to easily go from a *.ico file (maybe Windows only) to
a bitmap% or something else I can use in program?

I see the function read-icos in file/ico, and also the function ico->argb
which gives a bytes? that represents an argb image, but I can't figure out
how to get from a bytes? to an actual argb?.

Cheers,

Kieron

****

#lang racket/base

(require file/ico)

(read-icos "icons\\an-icon-file.ico")

(map
  (lambda (x)
    (printf "ico:(~ax~ax~a)~n" (ico-width x) (ico-height x) (ico-depth x)))
  (read-icos "icons\\an-icon-file.ico"))

(require mrlib/cache-image-snip)

(map (lambda (x) (argb->bitmap (ico->argb x))) (read-icos
"icons\\an-icon-file.ico"))

****

Gives results:

'(#<ico> #<ico>)

ico:(32x32x4)
ico:(16x16x4)

'(#<void> #<void>)

. . argb->bitmap: contract violation
 expected: argb?
 given: #"\0\0\0\0\0\0\0\0\0\0\0\ ...
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to