Page 1 of 1

Importing an image

Posted: Mon Mar 11, 2019 7:44 pm
by NullSet
Forever the newbie, I've forgotten how to import an image.

To be specific, I've got an image file saved on my hard drive. I know how to display that on a card.

I want to import the image data, so reference to an external file will not be necessary for the image to display on the card. I hope I made that clear enough.

I don't need an elaborate explanation, just the basic idea.

Thanks in advance.

Tim

Re: Importing an image

Posted: Mon Mar 11, 2019 7:47 pm
by Klaus
Hi Tim,

...
import paint from file "path/to/your/image.jpg"
...

Best

Klaus

Re: Importing an image

Posted: Mon Mar 11, 2019 7:53 pm
by richmond62
imgImport.jpg

Re: Importing an image

Posted: Mon Mar 11, 2019 8:27 pm
by NullSet
Klaus wrote:
Mon Mar 11, 2019 7:47 pm
...
import paint from file "path/to/your/image.jpg"
...
That's the ticket! Thanka, Klaus!

Looks like the image data is stored in the image object, not the card or stack. Correct?

Is there a convenient way to save the image data in the card or stack instead? In that case, how do I reference the source in the image object?

Tim

Re: Importing an image

Posted: Mon Mar 11, 2019 8:38 pm
by Klaus
Hi Tim,
NullSet wrote:
Mon Mar 11, 2019 8:27 pm
Looks like the image data is stored in the image object, not the card or stack. Correct?
correct.
NullSet wrote:
Mon Mar 11, 2019 8:27 pm
Is there a convenient way to save the image data in the card or stack instead? In that case, how do I reference the source in the image object?
You can use a custom property of the stack to store the binary image data like:

Code: Select all

...
set the cStoredImage of this stack to url("binfile:path/to/your/image.jpg")
...
Then you can later use it like:

Code: Select all

...
put the cStoredImage of this stack into img "your image here..."
...
Best

Klaus

Re: Importing an image

Posted: Mon Mar 11, 2019 8:54 pm
by NullSet
Klaus wrote:
Mon Mar 11, 2019 8:38 pm
You can use a custom property of the stack to store the binary image data like:
Perfect!

Tim

Re: Importing an image

Posted: Mon Mar 11, 2019 9:02 pm
by Klaus
NullSet wrote:
Mon Mar 11, 2019 8:54 pm
Klaus wrote:
Mon Mar 11, 2019 8:38 pm
You can use a custom property of the stack to store the binary image data like:
Perfect!
Yes. :D

Re: Importing an image

Posted: Mon Mar 11, 2019 10:36 pm
by NullSet
Is there a way to script:

Code: Select all

set the cStoredImage of this stack to url("binfile:path/to/your/image.jpg")
With a dialog box to select the image file I want?

Thanks!

Tim

Re: Importing an image

Posted: Mon Mar 11, 2019 10:39 pm
by SparkOut
I would be more specific with code suggestion if not on phone keyboard here, but looking up "answer file" will give you the info you need.

Re: Importing an image

Posted: Mon Mar 11, 2019 11:00 pm
by NullSet
SparkOut wrote:
Mon Mar 11, 2019 10:39 pm
"answer file" will give you the info you need.
I remember now! Rusty!!! Thanks SparkOut :D

Tim