Page 1 of 1

Exporting all images from a stack

Posted: Fri Jun 27, 2014 2:25 pm
by andyh1234
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

Re: Exporting all images from a stack

Posted: Fri Jun 27, 2014 8:49 pm
by Simon
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

Re: Exporting all images from a stack

Posted: Sun Jun 29, 2014 12:34 am
by andyh1234
Thanks Simon, I appreciate that.

Andy

Re: Exporting all images from a stack

Posted: Sun Jun 29, 2014 4:26 pm
by richmond62
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.

Re: Exporting all images from a stack

Posted: Sun Jun 29, 2014 6:31 pm
by andyh1234
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!