• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by frevd · Aug 29, 2013 at 03:13 AM · how many

How to safely manage 100 large JPEGs in a picture viewer app

So here is my problem, and I need a conceptional solution for it.

I'm having 100 JPEGs to show in a picture viewer app. Every JPEG is up to Retina resolution so might have 2880x1800. My Asset folder is 100 MB, which is the total size of the compressed JPG files. I put all those textures into a Resources folder and enabled automatic compression in the texture properties. Now I made a test build for Android and got a shocking 1.3GB large APK. Question - why can't textures not be saved in a compressed manner like they can on disk? Why do 100MB of input files result in a Gigabyte of APK, which is also compressed?? I do understand that the factual VRAM usage would be several Gigabytes of course, but why the package? The only solution for me would be to host the JPEGs on a server and load them (even though that leads to ugly breaks in interactivity of several seconds whenever a texture gets initialized due to single-threading in unity). And if I do that - how does unity manage the memory when I load texture after texture (but unloading objects once no longer displayed)? Will I run into problems which will make the app crash after some textures were loaded? How in the world can such an app be realized at all? I'm seriously thinking about using PhoneGap and create a stupid HTML-App, since it apparently is much more capable than unity to manage such a task, even though animations would be more difficult. Any ideas how to safely do that in unity? Many thanks, frevd

Comment
Add comment · Show 8
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image getyour411 · Aug 29, 2013 at 03:23 AM 0
Share

Did you look at your build log and see if there are other unintended elements in Resources (or subfolders of Resources) that is artificially driving your size up?

avatar image sooncat · Aug 29, 2013 at 04:24 AM 0
Share

try to check texture Import settings: 1.disable Read/Write Enable 2.disable Generate$$anonymous$$ip$$anonymous$$pas

avatar image frevd · Aug 29, 2013 at 10:31 AM 0
Share

Oh right, thanks for the hint. The build takes an hour or so, so I didn't try often. Read/write was disabled and the $$anonymous$$ip$$anonymous$$aps I need to display pictures in various sizes, even though using GUI.DrawTexture. However, Textures are NPOT (not square and not power-of-2).

The log file says:

 Textures -1346028.3 kb 100.6% 
 $$anonymous$$eshes 0.0 kb -0.0% 
 Animations 0.0 kb -0.0% 
 Sounds 0.0 kb -0.0% 
 Shaders 0.0 kb -0.0% 
 Other Assets 480.8 kb -0.0% 
 Levels 25.1 kb -0.0% 
 Scripts 10.8 kb -0.0% 
 Included DLLs 4.9 mb -0.4% 
 File headers 2.0 mb -0.2% 
 Complete size -1338458.1 kb 100.0% 
 
 Used Assets, sorted by uncompressed size: 
 46.5 mb -3.6% Assets/Resources/_Torre_16.jpg 
 ... 
 31.6 mb -2.4% Assets/Resources/2012_04_03__caracas_00326.jpg 
 ...
 21.5 mb -1.6% Assets/Resources/Floor_Plans_All.jpg 
 ... 
 14.0 mb -1.1% Assets/Resources/2011_05_06__caracas10_00592.jpg ... 
 9.6 mb -0.7% Assets/Resources/UTT_$$anonymous$$C_Section_La_Ceiba.jpg 
 ... 
 
 *** Completed 'Build.Player.AndroidPlayer' in 2396 seconds 

Something is wrong here definitely.

avatar image frevd · Aug 29, 2013 at 11:17 AM 0
Share

I made another test by re-saving the input JPG using Paint.Net (original is from PS), also saved as PNG. No difference between them whatsoever though. The JPEG is 872$$anonymous$$B (quality 80%), why is the package size 23.9mb? Even including the mipmap 33% that doesn't fit.

 Used Assets, sorted by uncompressed size:
  23.9 mb     29.9% Assets/Resources/1_Prototype_$$anonymous$$etroCable_System3.png
  23.9 mb     29.9% Assets/Resources/1_Prototype_$$anonymous$$etroCable_System2.jpg
  23.9 mb     29.9% Assets/Resources/1_Prototype_$$anonymous$$etroCable_System.jpg
avatar image frevd · Aug 29, 2013 at 11:30 AM 0
Share

It must a bug in unity. The picture at 2669x2350 produces 17$$anonymous$$B (without mips), the picture with power-of-two at 2048x2048 produces 2$$anonymous$$B, wtf? Also it seems the AP$$anonymous$$ are not being compressed again (even the PNG is only 5.2$$anonymous$$B, but the ETC ist 17$$anonymous$$B in the package). I can't believe that there is not even a simple GZIP compression over the package. I cannot explain to my non-technical client, why I can't display a handful of full-screen pictures in the app, because even four of them would make the AP$$anonymous$$ go over the 50$$anonymous$$B-Limit..

avatar image frevd · Aug 29, 2013 at 11:35 AM 0
Share

The only chance that I have is to put the JPEGs as TextAssets (.bytes files) into a Resources folder and load them at runtime.

avatar image robertbu · Aug 29, 2013 at 11:35 AM 1
Share

Ugly hack: There should be a way to include files with the build such that they appear at the Application.persistentDataPath of the build on Android (I can on iOS). If so, then you can use the WWW class to load the images.

avatar image frevd · Aug 29, 2013 at 12:40 PM 1
Share

Okay, seems the problem is the NPOT thing.

http://forum.unity3d.com/threads/54954-NPOT-Textures

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to identify a different camera? Urgent 1 Answer

shot delay in between bullets 1 Answer

Some small questions regarding files and directories. 0 Answers

how do you make walking audio for android? 1 Answer

How to display and Hidden Label or Box ?? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges