Page 1 of 1

Make a round photo icon for OSX and Mobile

Posted: Wed Jul 28, 2021 9:03 pm
by trevix
I am trying, as login process of my standalone, to let the user shot or load his photo, making a round PNG image out of it.
A PNG because, at the end of the job, I would like to have a alpha transparent background that show only the circle with the photo on it.

I've got some code and ispiration here:
http://forums.livecode.com/viewtopic.ph ... 80#p135480
viewtopic.php?f=7&t=31825&start=15

As of now, on OSX only, I can load an image, resize it, move it.
My problem is taking a snapshot of the result: somehow the snapshot doesn't work. Not to talk having an image with alpha channel (wich I don't really understand).
ImageResizePhoto.livecode.zip
(29.65 KiB) Downloaded 209 times
Any suggestion or stack improvement is welcomed.
Trevix

Re: Make a round photo icon for OSX and Mobile

Posted: Wed Jul 28, 2021 11:22 pm
by andresdt
Hi trevix
Today I created a thread wondering why the roundRadius property is not present in groups. Now I see that it would also be nice if the images had it.
The problem you are facing I have already faced and here is the solution I found.
The code is on the stack that I attach.
look at the exportSnapshotPNG command

Re: Make a round photo icon for OSX and Mobile

Posted: Thu Jul 29, 2021 12:18 am
by ClipArtGuy
trevix wrote:
Wed Jul 28, 2021 9:03 pm

Any suggestion or stack improvement is welcomed.
Trevix

This script works in your saveImage button.

Code: Select all

on mouseUp pMouseButton
  export snapshot from rect(the rect of graphic "PhotoCircle") of this card to tFileVar as PNG
   put tFileVar into image "FinalImage" of card "cardShow"
   go card "cardshow"
end mouseup

Re: Make a round photo icon for OSX and Mobile

Posted: Fri Jul 30, 2021 10:12 am
by trevix
Great answers: thanks