Exporting all images from a stack

Are you developing tools to extend the LiveCode environment? This is the place to talk about the nuts and bolts of extending our nuts and bolts. If you want to use a LiveCode or third party Environment extension, visit the Using Evironment Extensions forum.

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
andyh1234
Posts: 379
Joined: Mon Aug 13, 2007 4:44 pm
Location: Sale UK / FL USA
Contact:

Exporting all images from a stack

Post by andyh1234 » Fri Jun 27, 2014 2:25 pm

Hi,

Just wondering if anyone has written code yet to export all the images from a stack before I re-invent the wheel :)

With retina working now, I just want to pull all the images from stacks so I can see what needs re-sizing or replacing, then put the larger images back in.

Thanks

Andy

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Exporting all images from a stack

Post by Simon » Fri Jun 27, 2014 8:49 pm

Hi Andy,
This isn't directly a response to your question but get this when you are ready;
http://livecodeshare.runrev.com/stack/7 ... dependence
Provides automatic scaled images with the correct file names
<image>@ultra-low.<ex> - 0.25x
<image>@extra-low.<ext> - 0.5x
<image>@low.<ext> - 0.75x
<image>@medium.<ext> / <image>.<ext> - 1x
<image>@high.<ext> - 1.5x
<image>@extra-high.<ext> / <image>@2x - 2x
<image>@ultra-high.<ext> - 4x

And I guess for the original question
repeat with x = 1 to the number of cd of this stack
repeat with y = 1 to the number of images of cd x
put the short name of img y of cd x into tName
put char -3 to -1 of tName into tExt
export image 1 to file tName as tExt
etc.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

andyh1234
Posts: 379
Joined: Mon Aug 13, 2007 4:44 pm
Location: Sale UK / FL USA
Contact:

Re: Exporting all images from a stack

Post by andyh1234 » Sun Jun 29, 2014 12:34 am

Thanks Simon, I appreciate that.

Andy

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2748
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Exporting all images from a stack

Post by richmond62 » Sun Jun 29, 2014 4:26 pm

I should have thought all you need is a couple of nested REPEAT statements
that chew their way through all the images on all the cards.

Have a go with the attachment :)

This stack has only one card with 5 images: but as a proof of concept it is just fine.
Attachments
img_exp.livecode.zip
(37.57 KiB) Downloaded 119 times

andyh1234
Posts: 379
Joined: Mon Aug 13, 2007 4:44 pm
Location: Sale UK / FL USA
Contact:

Re: Exporting all images from a stack

Post by andyh1234 » Sun Jun 29, 2014 6:31 pm

Thanks,

Ive not been using livecode for a while due to an illness and am just getting back into it. Id just forgotten some of the commands, this really helps, thanks!

Post Reply

Return to “Extending LiveCode”