Importing an image
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Importing an image
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
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
Hi Tim,
...
import paint from file "path/to/your/image.jpg"
...
Best
Klaus
...
import paint from file "path/to/your/image.jpg"
...
Best
Klaus
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Importing an image
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
Hi Tim,
Then you can later use it like:
Best
Klaus
correct.
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")
...
Code: Select all
...
put the cStoredImage of this stack into img "your image here..."
...
Klaus
Re: Importing an image
Is there a way to script:
With a dialog box to select the image file I want?
Thanks!
Tim
Code: Select all
set the cStoredImage of this stack to url("binfile:path/to/your/image.jpg")
Thanks!
Tim
Re: Importing an image
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.