Compressing Images to be stored in Cloud

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Compressing Images to be stored in Cloud

Post by FourthWorld » Tue Jul 08, 2014 11:27 pm

William Jamieson wrote:@Richard:
Would you happen to know a quick and easy way to resize and change the filesize of PNGs and GIFs Richard?
Same as Simon suggestion, with export snapshot. But by doing it in the client (assuming the client app is make with LC) you'd be uploading a much smaller file, and with the resizing done in advance the server load would be very minimal.
BTW I hope to see you at RunRev Live 14 in San Diego. Just got my ticket!
Looking forward to it. Many good sessions lined up, with lots of celebration in between. Should be a good time. San Diego's a wonderful place.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

William Jamieson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 212
Joined: Fri Feb 01, 2013 1:31 am
Contact:

Re: Compressing Images to be stored in Cloud

Post by William Jamieson » Wed Jul 09, 2014 4:03 am

You are absolutely right. The word as is the critical factor.

After looking at the documentation on export snapshot, in the examples they included PNG format. Here is the sample code:

Code: Select all

export snapshot from Field 1 to file "File1.png" as PNG
I am going to test if this preserves the alpha transparency of an image in a sec.

William Jamieson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 212
Joined: Fri Feb 01, 2013 1:31 am
Contact:

Re: Compressing Images to be stored in Cloud

Post by William Jamieson » Wed Jul 09, 2014 4:17 am

Yess!!! I confirmed that it does indeed preserve alpha transparency!! Thank you Simon and Richard! Ah I think I got confused about the difference between import snapshot and export snapshot. I still don't really understand the difference, but when I went to go look up your suggestion or try use it, I was using the import command rather than export.

Rookie mistake. Glad I'm in the rookie forum :D

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Compressing Images to be stored in Cloud

Post by FourthWorld » Wed Jul 09, 2014 4:34 am

William Jamieson wrote:Yess!!! I confirmed that it does indeed preserve alpha transparency!!
As a general rule, both import and export will preserve the inherent transparency of any object provided you use the "of object" rather than "from rect" form.

The older "from rect" form grabs a specific rect from the composite buffer, so it's doesn't have the smarts to do anything more with it. But the newer "of object" form causes the object to be rendered directly into its own new buffer.

Extra cool is that the newer "of object" form can be used on any object, not just images, including buttons, groups, etc., and will leave the empty space around objects as transparent in the resulting alpha channel.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply