Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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
1
Question by albusorin · Dec 17, 2015 at 05:25 PM · androidimageload

Load Image from local folder on Android not working

Hi, I have a canvas (myCanvas) component, and I try to set this file(DSC06754.JPG about 7 MB, 4912x2760), but it gives me a blue screen, and no errors. With other images it works, but this one that I shoot with my own camera don't want to show! What can be the problem? I discover that if I resize that to lower resolution than I can see the picture ok.

Here is my code that I use to load image to my canvas:

 private IEnumerator LoadPicture(string file)
 {
     WWW www = new WWW("file://" + file);
     yield return www;
     www.LoadImageIntoTexture(_texture2D);
     myCanvas.GetComponent<CanvasRenderer>().SetTexture(_texture2D);
  }

This is how it looks:

alt text

And if I copy from my computer to Android a picture (Penguins.jpg) and load, it looks ok.

alt text

dump-5086947356325350807.png (20.9 kB)
dump-4311673398027142326.png (204.8 kB)
Comment
Add comment · Show 5
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 VonTala · Jan 11, 2016 at 09:14 PM 0
Share

any news ?

avatar image DeveshPandey · Aug 31, 2016 at 07:52 PM 0
Share

I am facing same problem... any solution??

avatar image Panchulonz · May 22, 2017 at 08:45 PM 0
Share

did you find an answear by two years after? I have the same issue

avatar image sumit9236 · May 23, 2017 at 07:20 AM 0
Share

can you share me file location in your phone.

avatar image Bunny83 · May 23, 2017 at 07:43 AM 0
Share

The image is most likely simply too large An image of the size (4912x2760) would require about 40$$anonymous$$B of memory on the graphics card. Though if the hardware doesn't support that large images there's no way around that. To be able to load such a large image you would have to use a third-party image library that can load the image into memory and then downsample it so you can hand it over to Unity.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Suduckgames · May 23, 2017 at 07:24 AM

You are probably having problems with android memory, Android memory is very limited so instead of load the texture direcly you will need to resize the image, In case you still want the same size, you will need to make a image loader manager in order to specify the quality, dpi, and others options instead of direct load it into the canvas

Comment
Add comment · Share
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
0

Answer by Z-Farmer · Dec 04, 2017 at 02:18 AM

this is a unity bug, i will show u hot to pass this bug

         byte[] bytes = www.GetBytes();//Config.ReadFileByte(path);
 //        tex2d = new Texture2D(1,1,TextureFormat.ARGB32,false);
 //       do not disable minmap! it importent
         tex2d = new Texture2D(1,1,TextureFormat.ARGB32,true);

         ImageConversion.LoadImage(tex2d, bytes, true);
 
         sky.SetTexture("_Tex", tex2d);

when the picture size more than 4k and the minmap was disable it will back the blue picture.... i not sure what they happen but this is the reson...

so use my method can load success, but when

1.disable minmap

2.pciture size more than 4k

it still will get a blue pciture...

Comment
Add comment · Share
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

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.

Follow this Question

Answers Answers and Comments

10 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

Related Questions

How to load image from android gallery 0 Answers

pick image from android gallery 3 Answers

Save and Load in the build 0 Answers

my textures aren't working (bmp files issue) 3 Answers

Android loading indicator missing after splash screen 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