Page 1 of 1
Exporting a snapshot more larger than the card containing it
Posted: Fri Jan 25, 2013 4:16 pm
by Mag
Hi all,
I'm trying to save an image containing some controls (in an hiden card) to share it via social networks. With iPhone 4 all goes OK but with iPhone the image is cropped at the size of the screen.
Code: Select all
export snapshot from rect snapRect of cd "sharePreview" to url ("binfile:"&tFolder&"/fotoPerShare.jpg") as JPEG
Somebody knows if there is a way to accomplish this?

Re: Exporting a snapshot more larger than the card containin
Posted: Fri Jan 25, 2013 5:24 pm
by Mark
Hi,
Make a group of the objects you want to export as a picture and export a snapshot of the group. The group has to large enough to show all controls if the card were that big.
Kind regards,
Mark
Re: Exporting a snapshot more larger than the card containin
Posted: Fri Jan 25, 2013 7:02 pm
by Mag
Thank you so much Mark!
PS
It seems that the URL of your signature doesn't work
Re: Exporting a snapshot more larger than the card containin
Posted: Fri Jan 25, 2013 7:29 pm
by Mark
Hi,
The Qery URL is broken. I'll fix that shortly.
Mark
Re: Exporting a snapshot more larger than the card containin
Posted: Fri Jan 25, 2013 7:49 pm
by jacque
Or if you don't want to group everything, you can do it directly this way:
export snapshot from this cd to file "cardsnap.jpg" as jpeg
The "from" syntax will include everything regardless whether it is visible on screen or not and regardless of the size.
Re: Exporting a snapshot more larger than the card containin
Posted: Fri Jan 25, 2013 9:34 pm
by Mag
Thank you Jacque!
Re: Exporting a snapshot more larger than the card containin
Posted: Sat Jan 26, 2013 2:24 am
by Mag
Done some testing, well, if I export from card I get some unwaited blank space. If I export from group I get a weird black 4 pixel frame. BTW I think that I need to test a bit more to setup things in the good way...
Re: Exporting a snapshot more larger than the card containin
Posted: Sat Jan 26, 2013 1:23 pm
by Mag
Unfortunately I continue to get mixed results, this could be probably due by the fact that I dinamically resize the content of the card before to take the screen shot.
Code: Select all
on preparePostcard
lock screen
go to cd "sharePreview" -- it needs it to refresh photo dimensions, frame dimensions etc, altough thet don't change
put specialFolderPath("documents") into tFolderPath
put tFolderPath & "/customPreviewPhoto.JPG" into tFilePath
set the filename of image "imageBox" of cd "sharePreview" to "" -- to be sure to reset the image, maybe doesn't need it
set the filename of image "imageBox" of cd "sharePreview" to tFilePath
-- set the frame
set the height of graphic "postcardFrame" of cd "sharePreview" to (the height of image "imageBox" of cd "sharePreview" + 40)
set the width of graphic "postcardFrame" of cd "sharePreview" to (the width of image "imageBox" of cd "sharePreview" + 40)
set the loc of graphic "postcardFrame" of cd "sharePreview" to the loc of image "imageBox" of cd "sharePreview"
-- set the logo
set the loc of image "logo" of cd "sharePreview" to (the loc of image "imageBox" of cd "sharePreview") -- center it
set the top of image "logo" of cd "sharePreview" to (the top of graphic "postcardFrame" of cd "sharePreview" - 22) -- move to top
set the loc of button "mark" of cd "sharePreview" to (the loc of image "imageBox" of cd "sharePreview") -- center it
set the bottom of button "mark" of cd "sharePreview" to (the bottom of graphic "postcardFrame" of cd "sharePreview" + 40) -- move to bottom
-- set the screenShot rect
set the loc of graphic "snapshotRect" of cd "sharePreview" to (the loc of image "imageBox" of cd "sharePreview")
set the height of graphic "snapshotRect" of cd "sharePreview" to (the height of image "imageBox" of cd "sharePreview" + 130)
set the width of graphic "snapshotRect" of cd "sharePreview" to (the width of image "imageBox" of cd "sharePreview" + 130)
set the bottom of graphic "snapshotRect" of cd "sharePreview" to (the bottom of graphic "snapshotRect" of cd "sharePreview" + 16) -- move to bottom by 20 pixels
go to cd "mainContent" -- back to main cd
unlock screen
end preparePostcard
Re: Exporting a snapshot more larger than the card containin
Posted: Sat Jan 26, 2013 8:44 pm
by jacque
It looks like you want to get a snapshot of only a particular area of the card (snapshotRect), not the entire card. If so, the grouping the objects and exporting a snapshot from the group is the right approach. If the snapshot has border lines then one of the objects might have its showBorder set to true.
Try grouping everything, exporting a snapshot, and then uploading that image here so we can see what you get.
Re: Exporting a snapshot more larger than the card containin
Posted: Sat Jan 26, 2013 9:58 pm
by Mag
Thank you jacque, I do some testing following your advice and I discover that the the black border were due by the black background of the stack ( I use the black bg because it's the best option for the flip effect) I then set card by card the white bg. I solved the problem making opaque and white the rect I use as "container" for the snapshot (snapshotRect). Now all works fine!
Re: Exporting a snapshot more larger than the card containin
Posted: Sat Jul 19, 2014 4:51 pm
by Mag
Hi all!
So, I'm here with a new question about this powerful command.
This is what I learnt about export snapshot command to date:
export snapshot from rect
crops everything is not currently displayed on the card
export snapshot from group
exports everything is content in the group so you can't choose e rectangle from which to export
(BTW when you use it remember to set the margins to the group to 0 to avoid to include card bg parts)
crop command
can't use it before to export a snapshot if you have an image that displays a file referenced
set the imagedata
set the imagedata of an image to the imagedata of the same image don't work for referencing images so can't use to then use the command crop
At this point I can't imagine a way to export a part of an image that is not completely displayed in a card.
Any help will be appreciated!

Re: Exporting a snapshot more larger than the card containin
Posted: Sat Jul 19, 2014 5:54 pm
by Klaus
Hi Mag,
Mag wrote:At this point I can't imagine a way to export a part of an image that is not completely displayed in a card.
WHAT part of an image do you want to "snapshot"?
Just created a little stack with an image that covers more than the card and put this into button script
to export a part of the image that is not visible on the card:
Code: Select all
on mouseUp
put specialfolderpath("desktop") & "/snap.jpg" into tFile
export snapshot from rect(20,20,560,360) of img 1 to file tFile as JPEG
end mouseUp
Worked as exspected!
Best
Klaus
Re: Exporting a snapshot more larger than the card containin
Posted: Sat Jul 19, 2014 9:09 pm
by Mag
Hi Klus, unfortunately it seems to me that it crops the non visible part of the image...
I'm doing something wrong... let me double check...
Re: Exporting a snapshot more larger than the card containin
Posted: Sat Jul 19, 2014 10:08 pm
by Mag
I again,
so I had forget to refer to the image object:
export snapshot from rect(20,20,560,360)
of img 1 of card xy to file tFile as JPEG
all work fine now, thank you for the help!
