How to reduce the decodeImage progress time - flutter

I'm trying to merge two images into one image in my flutter application
I used Image library to do so
but when I use the decodeImage function in this way
image.decodeImage(images[0].readAsBytesSync());
to merg two images with large size
the app freezed for upto 1 minute
any solution to speed it up

Your app is not freezing, you just have to show loading indicator because this process take time.
show CircularProgressIndicator until this process doesn't finished.

Related

Is it possible to render 1-2 thousand images in Flutter?

I am using Flutter to develop a game. I would like to display 1-2 thousand small images that can move (via a AnimatedPositioned widget for example) on the screen. The resolution will be very low of each individual image of course. I'm unsure if Fluttter has a feature or is able to handle such a feature and would like to know if it's possible, and if so, best method to get there.
I've tried displaying 1000 images using Image.asset('my_image.PNG') in a GridView.builder(), using the profiler, my emulator was only able to achieve 6fps average.

Is there a way to display images from the internet immediately with zero delay?

My idea is to predownload them upon the first page or the page in question before the widgets are displayed, and then once they are downloaded, displaying the images will be as fast as displaying a Text widget for instance.
I have researched a lot based on Cached Network Images, Flutter Cache Manager and precache images, but all of them have a delay in loading the image.
The idea is that since it is finished downloading, it should display it immediately. And the downloading should happen in secret, before the page is loaded.
Any solutions?
cached_network_image support precache
https://github.com/Baseflow/flutter_cached_network_image/issues/646#issuecomment-905275798
and also
https://api.flutter.dev/flutter/widgets/precacheImage.html

Ionic product Image loading

I am developing a shopping app using web API,
But getting issues like whenever app open
It will take to much time to load products.
Maybe from product image will take time to render
, any idea how to resolve this issue
U can improve a performance of your app by doing following steps
Use pagination(i.e load 10 or 15 product from web api) on scroll
Maintain low size images at server so it could load fast.
Show a busy image while the actual image is downloading, and when the image is downloaded, remove busy image and show the actual image.
1 - use ion-infinite-scroll
2 - lazy load the images
3 - use image cache

Is there any problem for loading images more than 200 from resource folder?

My application contains more than 200 images each with size approx. 15 KB. I want to flip these image one by one. Is there will be any time lag for loading images? Is there any alternate method for doing that?
Anyone please help!
My application contains more than 200 images each with size approx. 15 KB. I want to flip these image one by one.
OK.
Is there will be any time lag for loading images?
Maybe. Try it and see. If there is, run your app under Instruments to see what really caused it.
Is there any alternate method for doing that?
You haven't proposed a primary method to be alternate to.
The main thing is that, since this is an iPhone app, you're probably not going to need 200 images loaded at once. Consider the Home screen: Those icons are about as small as is practical, and there are only 20 (24 on the iPad) of them on the screen at one time.
Assuming you want to allow scrolling or paging through the list, you'll probably want to keep a pageful up and a pageful down already loaded and flipped and ready to display, to make scrolling/paging faster. That's still only 60–72 images, and you can do half to two-thirds of them after displaying the visible 20–36.
Moreover, are the images always flipped? If so, then flip them at build time and copy the flipped images into your app, and do no flips at runtime. Then you're just displaying images.

Is there a way to get images(64*64) from a server faster while running in Iphone?

I want to fetch images into my application cache in a faster way.
I do a map kinda app by loading at about 25 images at a time in a UIscrollView in which each image takes about 1 second for downloading.
All images are of size 64KB and 256*256 dimensions. I am doing caching, So after the first time when i scroll there will be around 7-8 images to load and that too takes each second each. So in the middle of scrolling the map it stops for around 7-8 seconds.
Is there a way that I can increase the speed of getting images, so that I will be able to load atleast 4-6 images a second?
You should use CATiledLayer, which spins off a separate thread for rendering each tile. It's how the Maps app does its drawing. You can have it download the images within the drawing code, and it won't block the main thread, so scrolling will be smooth. It'll still take time to download the images, but if you have a low-resolution proxy image you can show that while it loads the real image.
You need to free the main thread and do this on a background thread. When you're doing heavy work on the main thread, it will block and you app will appear unresponsive. (If you don't know on what thread you're running, your are probably on the main thread.)
Take a look at the apple concurrency guide.
Your web browser does this by spinning up a number of background fetch threads in parallel (reducing the overall download time) and displaying the map tiles as they come in (giving the illusion of higher responsiveness).
You can get a better feel for this by installing Firebug on Firefox, and then activate it while loading a complex page. It'll show you a graph over time of how long it takes each page component to be fetched, and this shows the parallelism.