Reputation: 231
Both, the official racket tutorial and the book, "Realm of Racket" suggest using Dr. Racket to load and define images in Racket.
I however am using Geiser (racket-repl) with Emacs. I define images using the
(make-object bitmap% (image-location))
function.
Is this the best way to load an image? Or are there more efficient and easy ways? I ask because I was confronted with this problem.
Upvotes: 2
Views: 1765
Reputation: 8523
If you are already using the 2htdp/image
library (which your other SO post suggests), then you may wish to use the bitmap
function from the same library. See this section of the documentation for 2htdp/image
.
You can use it like this:
#lang racket
(require 2htdp/image)
(define my-image (bitmap "path/to/image.png"))
Upvotes: 5