I have seen a lot of developer use all asset or images or drawable needed into one file png like this :
the question is how can developer split each image to use it in android ?
and what's advantage of this technique ?
This technique is mainly used in game development, and the file you linked is called a Texture Atlas.
It's main advantage is that the game engine has to load only one texture which saves a lot of memory writing, making the game run smoother.
Splitting is normally done with the help of an XML/JSON file which contains the coordinates and size of every image, that way the engine knows where each image is located in the atlas.
You can find more information about Texture Atlases here
Related
I am developing an Android app which has hundreds of .jpg files (over 300) each one of around 40kB. I would like to know if there is a way of reducing the size of my app. I looked at a similar question here Reducing Android App Size, but the problem still exists. Is there perhaps a way to compress the images and decompress them in real time when needed, or any other way to make my app more space efficient while not sacrificing speed?
If you have used tinypng for every resource you did your best with this kind of solution. In general, it's better to use vector graphics where the general icon will be <1kb. Also, a vector resource can be animated. If it's quite simply bitmaps, you can generate them in code on demand. Also, you can divide your app by dynamic features and each will be downloaded on demand with their part of the resources.
Is there perhaps a way to compress the images and decompress them in real-time when needed?
There is no standard Android solution out of the box. Probably, you can write something on your own. But this looks like too much effort.
Still, the most practical solution: use vector graphics as max as possible, generate in code what you can generate, compress with tinypng the others. That should be enough or you should have a very good reason for making some extra work.
For more info about vector graphics in android. For standard vector graphic import right in the android studio.
Web-site where you can download icons and insert them into the project.
I am currently working on an HDR application that requires the use of Camera2 to be able to customize HDR settings.
I have developed a customized algorithm to retrieve certain data from Raw DNG images and I would like to implement it on Android.
I am unfortunately not an expert in Java/Android, so I taught myself how to code. Using other formats, I have usually worked with bitmaps to retrieve pixel data. ( which was relatively an easy task concerning the existing methods )
Concerning DNG files, I have found no documentation showing me how to retrieve the pixels data. I thought of bufferizing the image, however the DNG file format contains many information other than pixels and I'm afraid I am unable to find an extraction strategy using bufferstream. (I just want to store the pixels inside an array)
Anyone has an idea ? Would highly appreciate some tips.
Best regards
Camera2 does not produce DNGs directly - it produces plain RAW buffers, which you can then save to a DNG via DngCreator.
Are you operating on the initial RAW buffers, or saving DNGs and then loading them back?
In general, DNGs are not full baked images, so quite a bit of code is needed to render them completely - see for example Adobe's DNG SDK.
We are creating a panoramic cardboard app. We want administrators to pick the photos on a server. How do we download those images on our device, and then set that in the skybox?
I am new to unity, but I do have audio clips being downloaded with WWW and I do have the skybox changing based on taps with resources that are bundled. I am not understanding images well enough to understand how to download and then apply to the skybox.
Unity skyboxes are cube maps comprised of 6 textures (top,bottom and 4 sides). So you need 6 textures, you can download via WWW and you can assign each to the correct property of the cubemap.
http://docs.unity3d.com/Manual/class-Skybox.html
A common panoramic format of course though is the cylidrical image, which has the full 360x180 degrees in a single image.
The editor has a handy feature that you can convert a texture of a cylidrical image straight to a cubemap, and then assign that to a skybox. This is very handy when you have want to make a skybox that is built into your game:
However, that is editor only - you can not perform that at runtime. You could create them in Unity, export as an asset bundle, and download that via WWW - but that would be a lot of work every time you wanted to create a new panorama!
For your situation, you would be better to not use a skybox, and instead create a 3d sphere with the normals facing inwards. And simply download cylindrical images via WWW and assign to the material on the sphere.
Note: you need several thousand polygons to make it render cleanly.
This is very theoretical question about general knowledge.
First of all I dont have so far alot of understanding about things in Open GL so please forgive me.:
The best idea to load a 3D Model into android is using Waterfall .obj files yes?
I downloaded sample model for sketchup (some robot model with alot of parts) and the .obj file has size of 3mb. I loaded it into vector of strings (almost 100k of lines) and the application is +15mb's heavier in ram usage!!!! So I am a bit concerned about this whole method.. and approach?
When I will load the model is there a simple way of rotating it and moving. Will it be like single object in open GL or do I need to multiply all thousands of verticals by matrix?
Is there anything else I should add to my understanding.
I can't answer all of your questions, but:
3) Yes. You can combine the Android framework's onTouchEvent() functionality to work with OpenGL. In OpenGL, you can rotate things very easily with simple glRotate(angle) calls (which will rotate everything for you), where the provided angle is variable based on your touch interaction.
EDIT::
2) Why are you loading it into Strings? I don't know models very well, but I parse many files. You should load into the smallest size variable you can. For instance an ArrayList of shorts, or something. I don't know your data, but that is the best way. Consider parsing in portions if you have memory issues.
I am creating a simple android app to view a comic book. The pages are large(0.5-1 mb each), high quality .png's and I am loading them into a webview to make use of the built in zoom controls. So far I only have 17 files and the APK size is already about 16 mb. I'm looking to add over 200 files in future updates. I can't really reduce the quality too much because there is small text that must be zoomed-in on to read. Any suggestions? A similar question was posted here: How to reduce App (.apk) Size, but I don't want to lose the quality of the images. I'm not sure if it's appropriate to link to here, but you can have a look at my app by searching for Tracer (by Detour Mobile) on the android market if it helps at all. Thanks in advance.
You could compress them without using lossy compression- e.g. zipping/rarring them, but I don't believe this would gain you much more than a few kilobytes here and there. Otherwise, try using a more compact format than PNG, such as JPEG (you won't lose too much quality.) By the way, all of this was suggested in the referenced post.
If you do decide to scale down the images' size somewhat, be sure to use a method like bicubic sharper- it tends to look better than others when reducing image size.
Another option would be to download the images for the comic that is being read on-the-fly with pre-fetching so reading would not be interrupted as much.
Consider placing your images in Assets folder as opposed to Res. The big difference is, Assets content won't be compiled into R.java class so you will see major storage savings. You'd have to modify your code though as you won't be able to call up the images via the regular r.resID notation, but it's doable
android offers a new way to deal with it.
android app bundle apk size has a maximum size of 150mb
but you can use an asset pack to seperate the apk from the static files
and upload your app
here is a more detailed explanation about asset packs:
https://developer.android.com/guide/playcore/asset-delivery
here is the guide for integrating asset packs with regular android app:
https://developer.android.com/guide/playcore/asset-delivery/integrate-java