How to show an image on a card without delay [SOLVED]
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 212
- Joined: Fri Feb 01, 2013 1:31 am
- Contact:
How to show an image on a card without delay [SOLVED]
Hello. Quite a simple problem I have for you today. I have a very small image (20kb) that I want to show on a card with minimal loading time on Android and iOS.
Here is the situation. I have a card with a button. I click the button. I want to go to another card with a button with the icon set to my 20kb image in less than 50 milliseconds on an Android device.
Here is a sample stack that demonstrates what I am trying to do. Try it out!
If you have any ideas how to get the time down to less than 50 milliseconds, please let us know because I couldn't find any post about this on the forum.
[When I deployed it to my phone it took 7 seconds]
-Will
Here is the situation. I have a card with a button. I click the button. I want to go to another card with a button with the icon set to my 20kb image in less than 50 milliseconds on an Android device.
Here is a sample stack that demonstrates what I am trying to do. Try it out!
If you have any ideas how to get the time down to less than 50 milliseconds, please let us know because I couldn't find any post about this on the forum.
[When I deployed it to my phone it took 7 seconds]
-Will
Last edited by William Jamieson on Fri Dec 19, 2014 3:08 am, edited 1 time in total.
Re: How to show an image on a card without delay
Hi Will,
Replace the answer with
put "Loading the image took " & tS2 && "milliseconds!"
Now how long does it take?
Simon
Replace the answer with
put "Loading the image took " & tS2 && "milliseconds!"
Now how long does it take?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- VIP Livecode Opensource Backer
- Posts: 212
- Joined: Fri Feb 01, 2013 1:31 am
- Contact:
Re: How to show an image on a card without delay
Hmmm.. Good question. I wouldn't know exactly because the put statement doesn't show any visual feedback on Android. But by the looks of it, about 8 seconds with me counting.
BTW Happy Holidays Simon!
-Will
BTW Happy Holidays Simon!
-Will
Re: How to show an image on a card without delay
Ahh OK caught me on that one 
So in testing the delay is in the image quality setting.
With your png;
Normal 27 ms
Good 27 ms
Best 9170 ms
With a 97 KB jpg image
Normal 45 ms
Good 53 ms
Best 106 ms
And yes it has to do with caching the image, if the image is on the first card, then it takes the approx 9 seconds to go from black screen to seeing the card.
Hey I did discover something I didn't know, on my Android device you don't actually have to hit the "OK" btn to make the dialog box go away, just touching the screen does it. Even with multiple responses (with "Yes" or "No" (ackkk!)).
Will, if you can confirm that we should bug it.
Simon
Edit; Hey... your image is 56 KB not 20

So in testing the delay is in the image quality setting.
With your png;
Normal 27 ms
Good 27 ms
Best 9170 ms
With a 97 KB jpg image
Normal 45 ms
Good 53 ms
Best 106 ms
And yes it has to do with caching the image, if the image is on the first card, then it takes the approx 9 seconds to go from black screen to seeing the card.
Hey I did discover something I didn't know, on my Android device you don't actually have to hit the "OK" btn to make the dialog box go away, just touching the screen does it. Even with multiple responses (with "Yes" or "No" (ackkk!)).
Will, if you can confirm that we should bug it.
Simon
Edit; Hey... your image is 56 KB not 20
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: How to show an image on a card without delay
Besides reducing the resolution, try displaying the image directly on card 2 instead of using it as a button icon, and see if that speeds it up.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 212
- Joined: Fri Feb 01, 2013 1:31 am
- Contact:
Re: How to show an image on a card without delay
No need Jacque. Simon was absolutely right! There is such a huge difference between setting the quality from 'good' to 'best', it is insane!
Solution: Create a couple sizes of image files that dont have to be resized so much so that we can get away with the 'good' setting. Wow, that caused every card on my app to speed up!
I think I would suggest to any future readers to stay away from setting the imageQuality to 'best' when developing for mobile. They simply cannot handle the graphics processing.
I will upload a sample file that allows you to play around with this phenomenon and try different resizeQualities.
Thank you Simon!
And thanks for your input Jacque.
-Will
Solution: Create a couple sizes of image files that dont have to be resized so much so that we can get away with the 'good' setting. Wow, that caused every card on my app to speed up!
I think I would suggest to any future readers to stay away from setting the imageQuality to 'best' when developing for mobile. They simply cannot handle the graphics processing.
I will upload a sample file that allows you to play around with this phenomenon and try different resizeQualities.
Thank you Simon!
And thanks for your input Jacque.
-Will
- Attachments
-
- Image Test.zip
- (54.16 KiB) Downloaded 169 times
-
- VIP Livecode Opensource Backer
- Posts: 212
- Joined: Fri Feb 01, 2013 1:31 am
- Contact:
Re: How to show an image on a card without delay [SOLVED]
BTW @Simon
I am not getting the same answer dialogue error as you. The dialogue box only goes away when i press "OK" or i use the BackKey. I
Might be specific to your version of LC?
I just used 6.6.2 and haven't noticed it on 7.0.1 RC3 and 6.7.1
-Will
I am not getting the same answer dialogue error as you. The dialogue box only goes away when i press "OK" or i use the BackKey. I
Might be specific to your version of LC?
I just used 6.6.2 and haven't noticed it on 7.0.1 RC3 and 6.7.1
-Will