Page 1 of 1
What´s wrong with this
Posted: Sun Jan 29, 2017 3:18 pm
by simon.schvartzman
Hi, this is what I want to accomplish running on iOS:
1- rotate an image
2- save it to the camera roll
Please help me identify what´s wrong with the code below . I would expect a left pointed arrow (the rotated image) to be saved to the camera roll but I'm getting the original picture...
Code: Select all
on mouseUp
set the angle of image "Img1" to the angle of image "Img1" + 90
put the long ID of image "Img1" into tImageID
mobileExportImageToAlbum tImageID
answer the result
end mouseUp
Re: What´s wrong with this
Posted: Sun Jan 29, 2017 3:57 pm
by richmond62
I don't know anything about work on mobile devices, but I do know something that might help you.
After you have rotated the image, lock it before you send it to the album.
There wasn't much point in uploading that stack as your images are referenced, not embedded.
Re: What´s wrong with this
Posted: Sun Jan 29, 2017 4:06 pm
by richmond62
I've embedded an image, and I make sure it is locked after it has been rotated.
Re: What´s wrong with this
Posted: Sun Jan 29, 2017 4:17 pm
by simon.schvartzman
Richmond, many thanks for your inputs...still no joy saving the rotated image...
Re: What´s wrong with this
Posted: Sun Jan 29, 2017 4:24 pm
by bn
Hi Simon,
when you rotate the image the original image is not rotated, you just rotate the display.
The easiest way would be to take a snapshot as png of the image and put the snapshot into a temporary image and export the temporary image.
If you need help (code) pseudocode for
export snapshot from image "img1" to tTemp as png; set the text of image "temp" to tTemp;
just say so
Kind regards
Bernd
Re: What´s wrong with this
Posted: Sun Jan 29, 2017 4:30 pm
by richmond62
You could consider taking a snapshot . . .
Re: What´s wrong with this
Posted: Sun Jan 29, 2017 4:38 pm
by simon.schvartzman
Hi Bernd, many thanks for your help, YES definitely need help with the code...can't make it work.
Best!
Re: What´s wrong with this
Posted: Sun Jan 29, 2017 4:47 pm
by simon.schvartzman
thanks Richmond, working like a charm now.
Best regards
Re: What´s wrong with this
Posted: Sun Jan 29, 2017 6:27 pm
by Klaus
One could also take a quick look into the dictionary, which often gives the missing informations!
From the entry about "angle":
...
Unlike the
rotate command, the
angle property affects only the screen display of the image, not the actual picture data in it.
Changing an image's angle does not change the imageData of the image.
...

Re: What´s wrong with this
Posted: Sun Jan 29, 2017 6:39 pm
by richmond62
a quick look into the dictionary
Now why would one want to do that?
Re: What´s wrong with this
Posted: Sun Jan 29, 2017 7:49 pm
by bn
Changing an image's angle does not change the imageData of the image
Err, imageData is actually changed. ImageData is what is rendered on screen. That is why you can make changes to an image like changing the dimensions of an image or angle make permanent by doing
Code: Select all
set the imageData of image "myImage" to the imageData of image "myImage"
Which sounds a bit nonsensical but it is the way to make those temporary changes to an image stick.
I am not quite sure but it seems by doing that (setting imageData to imageData) the image looses some specific format information necessare for PNG or JPG. The way to restore that information to make it a fullblown PNG or JPG is to use export image --- as PNG or JPEG, or just do a snapshot in the format you want.
KInd regards
Bernd
Re: What´s wrong with this
Posted: Sun Jan 29, 2017 7:55 pm
by bn
@Simon
Simon could you please use more descriptive headlines for your postings. Otherwise the whole discussion is unlikely to be of use to someone searching the forum.
"What's wrong with this" is not very specific. Although I ask exactly that same question myself all day when coding...
Kind regards
Bernd
Re: What´s wrong with this
Posted: Sun Jan 29, 2017 7:58 pm
by simon.schvartzman
will do so.