images in racket files

40 views
Skip to first unread message

Stephen De Gabrielle

unread,
Jul 19, 2019, 11:56:17 AM7/19/19
to Racket Users
Hi,
I'm trying to export an 'pict' image i have pasted in a DrRacket file,
e.g. 
#lang racket
(require pict)
(define my-pasted-image <pasted image here>)
(provide  my-pasted-image )

I can specify it in (provide ..) , but attempting to reference it causes this error 

../../../../Applications/Racket v7.3/collects/racket/private/more-scheme.rkt:261:28: write: cannot marshal value that is embedded in compiled code
  value: (object:image-snip% ...)
 

any ideas?

Laurent

unread,
Jul 19, 2019, 1:22:41 PM7/19/19
to Stephen De Gabrielle, Racket Users
Looks like your best bet is to save the pict as a bitmap in a separate file, then load it in your module and export this value.
From the top of my head:
where the pic is produced:
(send (pict->bitmap my-pict) save-bitmap "path-to/the-bitmap-file.png" 'png)
(or maybe: right click on the snip then save?)
then
(provide my-pic)
(define my-pic (bitmap "path-to/the-bitmap-file.png"))


--
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAGHj7-%2B-cP2zYHSODSASqDGYb1NUPCDy_hscoT4RU5VqQhr%3D2A%40mail.gmail.com.

Stephen De Gabrielle

unread,
Jul 19, 2019, 3:45:49 PM7/19/19
to Laurent, Racket Users
 thanks.

I was trying to help Connie with her language idea. 

Her eyes lit up when I pasted a pic of a waffle into DrRacket 

S.
--
----
Reply all
Reply to author
Forward
0 new messages