Saving an Image
Posted: Tue May 26, 2009 2:11 pm
Hi All,
Long time programmer ... new to Revolution.
I'm trying to get a feel for things and I'm having a little problem with images. I downloaded the ImageViewer example from the website and read through it and it mostly makes sense to me. I am just goofing around with some simple code to make sure I'm getting the concepts but something just isn't working for me.
I have a stack with 2 buttons and an image object (locked size and position). I'm just trying to load a picture into this then save it back out to another location. The image I am testing with is a JPEG. Here's the code:
LoadPicture Button
This works fine. I can see the picture on the screen.
SavePicture Button
This part doesn't exactly work. I get a file with the correct name in the correct location. It has some size to it. However, when I try to open this relocated file in any image viewer type program, it says it is "unsupported" or "corrupt".
I tried putting the text of the image instead of the imagedata per the ImageViewer sample tutorial, but the results are worse. I get the file but it has 0 size.
Any hints or insights would be greatly appreciated!
Long time programmer ... new to Revolution.
I'm trying to get a feel for things and I'm having a little problem with images. I downloaded the ImageViewer example from the website and read through it and it mostly makes sense to me. I am just goofing around with some simple code to make sure I'm getting the concepts but something just isn't working for me.
I have a stack with 2 buttons and an image object (locked size and position). I'm just trying to load a picture into this then save it back out to another location. The image I am testing with is a JPEG. Here's the code:
LoadPicture Button
Code: Select all
on mouseUp
answer file "Choose..."
if it is not empty then
set the filename of image id 1004 to it
end if
end mouseUpSavePicture Button
Code: Select all
on mouseUp
answer folder "Choose folder..."
if it is not empty then
put it into tFolder
put "binfile:" & tfolder & "/Test.jpg" into tSaveFile
put the imagedata of image id 1004 into URL tSaveFile
answer "Done"
end if
end mouseUpI tried putting the text of the image instead of the imagedata per the ImageViewer sample tutorial, but the results are worse. I get the file but it has 0 size.
Any hints or insights would be greatly appreciated!