How would you load (hundreds) of images in a React Native app? - image

I have to develop a mobile application that will have hundred of "cards" with an image. All images will be locally stored. I have seen that, in React Native, images are loaded using require and a constant file path string as parameter. I can create an array with all images user could need, but I don't know how memory is handled in this situations. Is there a better approach to solve that?

Haven't tried it yet, but react-native-fast-image might be what you are looking for!

Related

Manage resource images in Xamarin forms

I have been working on Xamarin forms for a long time now but the thing that has always bugged me is what is the better approach to store images in xamarin forms.
I wanted to know which images should I use from PCL and which ones should I put in native resource files or is using PCL images a bad approach altogether.
I went through everything in Local Images and Embedded Images but found nothing related to the better approach among them or performance or anything as such.
At the end after all the research for almost a year I came to the conclusion that the Local Image approach suits me better, even with the case where I had to add it to all three native projects depending what I target.
Reason being the following:
When I use local images I have an option to place different images in different size folders i.e. HDPI, MDPI(Android) and #2x,#3x(iOS)
What the above point does for me is it selects the image it should pick as per the current devices resolution which cannot be achieved with EmbeddedResources
One possible solution to issue mention above was using SVG's but as everyone knows that if the image you are using needs to look pixel perfect SVG's are not your best option as they lose some details here an there as you use them in your mobile devices.
One more cheeky thing I did (but I like to share my dev secrets) was whichever Images in my application were only in one size for all resolutions and platform or at least two of them I incorporated them in the Shared code
Note: Embedded Resource takes a little more time to load then your native Local Images always consider that while using

Unity 3D: Asset Bundles vs. Resources folder vs www.Texture

So, I've done a bit of reading around the forums about AssetBundles and the Resources folder in Unity 3D, and I can't figure out the optimal solution for the problem I'm facing. Here's the problem:
I've got a program designed for standalone, that loads "books" full of .png and .jpg images. The pages are, at the moment, the same every time the program starts. At the start of the scene for any "book", it's loading all those images at once using www.texture and a path. I'm realizing now, however, that this is possibly an non-performant method for accessing things at runtime -- it's slow! Which means the user can't do anything for 5-20 seconds while the scene starts and the book's page images load up (on non-legendary computers). SO, I can't figure out which of the three things would be the fastest:
1) Loading one asset bundle per book (say 20 textures # 1 mb each).
2) Loading one asset bundle per page (1 mb each).
3) Either of the first two options, but loaded from the resources folder.
Which one would be faster, and why? I understand that asset bundles are packaged by unity, but does this mean that the textures inside will be pre-compressed and easier on memory at load time? Does the resources folder cause less load time? What gives? As I understand it, the resources folder loads into a cache -- but is it the same cache that the standalone player uses normally? Or is this extra, unused space? I guess another issue is that I'm not sure what the difference is between loading things from memory and storing them in the cache.
Cheers, folks...
The Resource folders are bundled managed assets. That means they will be compressed by Unity, following the settings you apply in the IDE. They are therefore efficient to load at runtime. You can tailor the compression for each platform, which should further optimize performance.
We make expensive use of Resources.Load() to pull assets and it performs well on both desktop and mobile.
There is also a special folder, called StreamingAssets, that you can use to put bundled un-managed assets. This is where we put the videos we want to play at runtime, but don't want Unity to convert them to the default ogg codec. On mobile these play in the native video player. You can also put images in there and loading them is like using WWW class. Slow, because Unity needs to sanitize and compress the images at load time.
Loading WWW is slower due to the overhead of processing asset, as mentioned above. But you can pull data from a server or from outside the application "sandbox".
Only load what you need to display and implement a background process to fetch additional content when the user is busy going through the first pages of each book. This would avoid blocking the UI too long.
Optimize the images to reduce the file size. Use tinypng, if you need transparent images, or stick to compressed JPGs
Try using Power of 2 images where possible. This should speed up the runtime processing a little.
ath.
Great answer from Jerome about Resources. To add some additional info for future searches regarding AssetBundles, here are two scenarios:
Your game is too big
You have a ton of textures, say, and your iOS game is above 100 mb -- meaning Apple will show a warning to users and prevent them from downloading over cellular. Resources won't help because everything in that folder is bundled with the app.
Solution: Move the artwork you don't absolutely need on first-run into asset bundles. Build the bundles, upload them to a server somewhere, then download them at runtime as needed. Now your game is much smaller and won't have any scary warnings.
You need different versions of artwork for different platforms
Alternative scenario: you're developing for iPhone and iPad. For the same reasons as above you shrink your artwork as much as possible to hit the 100 mb limit for iPhone. But now the game looks terrible on iPad. What do?
Solution: You create an asset bundle with two variants. One for phones with low res artwork, and one for tablets with high res artwork. In this case the asset bundles can be shipped with the game or sent to a server. At run-time you pick the correct variant and load from the asset bundle, getting the appropriate artwork without having to if/else everywhere.
With all that being said, asset bundles are more complicated to use, poorly documented, and Unity's demos don't work properly at times. So seriously evaluate whether you need them.

How do you generate an Image in a Windows Phone Scheduled Agent?

I need to generate an imaged based on data returned from a WebService call within a PeriodicTask in a Windows Phone app (Mango+).
I've seen a few ways of doing it in the main app but nothing that seems to work from a Scheduled Task
It depends. If you're in a background agent, memory is precious. The libraries you load count against your allocation limit, too, so you have less than the advertised amount.
Do you have a base image that you're modifying? If so, avoid creating UI elements and try to work with a WriteableBitmap. There is a library (yes, memory, but it's incredibly useful) that provides useful methods for working with such images called WriteableBitmapEx.
If you're generating simple images from scratch, going the UserControl route is workable too.
Try this guide I've described on my blog:
http://suchan.cz/?p=110
Basically you have to create your own UserControl and then render it into image and save it either as jpg, without transparency, or as transparent png. Also make sure you use as low memory as you can in the Backgroud Agent, if you use more than 6MB in WP7 or 11MB in WP8, your periodic task will be killed without notice.
I use a utility called ImageTools to render a PNG from a user control (note, this is not my blog). I created a shared library, with references to ImageTools, ImageTools.IO.Png, and ImageTools.Utils. The shared library does all the heavy lifting. Then my background agent project references the shared library project, and in the ScheduledAgent.OnInvoke it calls into the shared library to do the work. I am on Windows Phone 8 but it seems to work very well.

TileMill with non map images

I'm building a web app that will use the tiling, zooming, marker and other functionality associated with map applications, however i dont need to use all this Geolocation and other stuff that TileMill requires as my application will be loading medical images not maps. Is it possible to import a custom image into TileMill? If so how? Maybe TileMill is completely unsuited to my specific application, if so could someone suggest an alternative?
Have you had a look at one of these?
PanoJS http://www.dimin.net/software/panojs/
jQuery TileZoom http://labs.webcodingstudio.com/tilegenerator/
Both libraries include scripts to generate all the tiles from the original photos and JavaScript libraries to display these on a web page.
It is doable but Tilemill is probably an overkill what you're looking for.
Simple plugins like the ones mentioned by #thisguyzaphod could do the trick. If you're looking to use featureful state of the art tile zooming, I would go with Leaflet.js it can be specifically used for non-geographic content like this page documents:
http://omarriott.com/aux/leaflet-js-non-geographical-imagery/
You can probably find some other valuable pointers here:
Is Leaflet a good tool for non-map images?
Good luck!

Free web image management

I am looking for free web image management system/script/...
I was using and still use photobucket service, but my account is free and has limited space and bandwidth. Now I am approaching the limits. On another side I have web hosting account and want to use it for image hosting instead or in addition to my photobucket. Sounds good. I can use ftp to upload my images and I am fine with it. What I miss is photobucket's web interface to my images. I am talking about photo galleries or portfolio like or something. But basic list of thumbnails, so I can see my images and easy get link to specific image in different formats to past into forum posts or into other web pages referring to that specific picture. Besides, I need easy way to organize pictures in albums/subalbums (like in file system). I see gazillion of image gallery systems, but have hard time to find for what I need. Oh, and I do not want database, just flatfiles/directories.
Anything come to mind?
There's Coppermine Gallery.
I was just looking for something similar.
I know Coppermine pretty well (I run a site powered by it): it is very flexible, with tons of options, and relatively easy to mod to your needs if you know a bit of php. It also reads and displays EXIF data if you configure it to do so. There is a lively community of developers for Coppermine. There is also a plugin that displays BBcode (http://forum.coppermine-gallery.net/index.php/topic,74043.msg356623.html#msg356623), unfortunately only image by image (not in bulk like the ImageShack Uploader). The drawback is that Coppermine is a pretty bulky script and does not perform super fast, especially on slow servers.
Bravenet seems to be a service more than a script.
I'm also checking out Lightbox 2 (http://lokeshdhakar.com/projects/lightbox2/#example) which seems nice and tiny, but not a chance of getting the EXIF file into the displayed image or getting the BBcode.
Will keep an eye on this thread

Resources