image files & their location

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

Post Reply
Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

image files & their location

Post by Jellobus » Fri Dec 12, 2014 7:57 pm

Hi All :D

I have over hundred image files attached in the App. They are attached as copy files in standalone settings.
The images will be consistently changed in the app. I like to achieve a shorter response time when image changes.

The attachment locations will be outside or inside of the stack. They are either attached as copy files(standalone application setting) or saved in the sub stack as import controls.(File>Import As Control>Image File..)

Would anyone tell me which way is better for the faster & stable performance?

Cheers,


Louis

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: image files & their location

Post by Klaus » Fri Dec 12, 2014 9:46 pm

Hi Louis,

how are you changing images?
Using ICONS in butttons seems to me the fastet method to "change images" :D


Best

Klaus

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: image files & their location

Post by Jellobus » Fri Dec 12, 2014 10:32 pm

Hi Klaus,

The app shows pictures. I currently I attached picture images as copy files.
The current script is

set the filename of image "picture" to "/bigImage/image_1.png"

but I am considering save pictures in the substack if it is faster.. the script will be

put image "image_1" of stack "substack" into image "picture" of stack "mainstack"

can you tell which one is better? and using icon is better way than using image ?

Cheers,

Louis

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: image files & their location

Post by Klaus » Fri Dec 12, 2014 11:30 pm

Hi Louis,
Jellobus wrote:...The current script is
set the filename of image "picture" to "/bigImage/image_1.png"
OK; the question is, is this method not fast enough?
At what "frequency" do you need to display the images?


Best

Klaus

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: image files & their location

Post by Jellobus » Fri Dec 12, 2014 11:52 pm

Hi Klaus,

if users click small image then big image pops up. the big image appears about 10-20 times per minute.

Cheers,

Louis

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: image files & their location

Post by Klaus » Sat Dec 13, 2014 12:01 pm

Hi Louis,

OK, that answers my question about "frequency", but the other answer ist still missing:
Is this method (setting the filenane) not fast enough for your purpose?
It should be, LC really does not take more than 2 seconds to load and display an image! :D


Best

Klaus

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: image files & their location

Post by jacque » Sat Dec 13, 2014 6:45 pm

I have a similar stack that displays many images on demand. They are stored as imported controls and the response time is very fast (I don't use icons, I do what you describe and replace the content of an existing image.)

There's a caution with this method. The engine caches images and if there are many large ones you can run out of memory and the app will crash. The workaround is to store the images in an unplaced group so they will not be cached. Keeping them in a substack should also do the same thing unless you open the stack directly.

But I would time the two methods and see if there is any significant difference. I doubt there would be very much,and the engine is optimized to read images from disk.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: image files & their location

Post by Jellobus » Thu Dec 18, 2014 12:34 am

Hi Jacque,

The image files are about 100 pics and 39MB in total. is it safe to attach them as copy files? if it could be crashed I must rework with my stack.
There's a caution with this method. The engine caches images and if there are many large ones you can run out of memory and the app will crash. The workaround is to store the images in an unplaced group so they will not be cached. Keeping them in a substack should also do the same thing unless you open the stack directly.
you suggested two things,

1. Store the images in an unplaced group
2. Keeping them in a substack <---what I am doing now

I got the #2 but what unplaced group mean in #1?

Cheers,

Louis

zaxos
Posts: 222
Joined: Thu May 23, 2013 11:15 pm

Re: image files & their location

Post by zaxos » Thu Dec 18, 2014 4:51 am

My guess is #1 he means invisible group... wich is good and by the way if your images are 39 mb then your standalone exe will also be about 50mb, when executed it will also be using up to 50mb ram wich isnt that much... You see where that gets, if your images get bigger then your standalone will be bigger, and use more ram and goes on..
Knowledge is meant to be shared.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: image files & their location

Post by jacque » Thu Dec 18, 2014 6:08 am

An unplaced group is not an invisible group. If you put 39 megs of images into an invisible group, the app may crash on machines with low memory, because the engine will try to cache all of them even if they can't be seen.

To create an unplaced group, put all the images into a group, select the group, and then choose "remove group" from the Objects menu. That will remove the group from the card, but it will still exist and the images can be referenced normally. Since they are not placed on the card they will not be cached.

However, with that many images, I think I would reference them as external images by filename. The engine is optimized for that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: image files & their location

Post by Jellobus » Thu Dec 18, 2014 7:52 am

Hi jacque, zaxos,

First of all sorry for the double posting..I got it. but do you know how to hide external image files in the desktop environment? I found that the saved standalone app shows all external files that I don't want users see. any way hide or lock them on the desktop environment?

And unplaced group is new to me..I think my app contains some unplaced group because I deleted some group images while I was building it. if there is unplaced group in the app, how do I clear them?

Cheers,

Louis

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: image files & their location

Post by jacque » Thu Dec 18, 2014 8:07 pm

There is no reliable way to hide images stored externally on disk.

Deleting an image from the stack does not affect the placement of a group that contains the image.If you delete the whole group itself, it is not unplaced; it is deleted and is no longer part of the stack. Groups can be on more than one card at a time, and to do that you "place" an existing group on a card. This is different than copying and pasting a group onto cards, which will create copies of the group and inflate the size of the stack. Instead, a placed group has only the single, original copy which is displayed on every card that it is placed on. Changing anything in that group will update the group for all the cards that use it, since all cards share the same copy of the group.

If a group is not assigned to any card, then it is unplaced. The group exists as part of the stack but is not used anywhere. You can reference objects in it normally but it is not part of the message path and is not shown on screen.

If a group is not placed on a card, it will be available in the Place Group menu item. To find out if the group is not placed on any cards, you'd need a little script that tests each card to see if it contains a group by that name.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: image files & their location

Post by Jellobus » Fri Dec 19, 2014 12:21 am

Hi Jacque,

so I guess that the advantage of creating an unplaced image group is as good as importing images to the substack because substack is never be seen? or it's different approach?

Cheers,

Louis

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: image files & their location

Post by jacque » Fri Dec 19, 2014 4:35 am

Yes, a substack would work the same way, as long as you don't view the card with the images. If viewed, they will be cached. A substack is probably easier if you aren't familiar with how groups work.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: image files & their location

Post by Jellobus » Fri Dec 19, 2014 5:37 am

alright, thanks for your advice! :D

Cheers,

Louis

Post Reply