Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 AhmadMujtaba · Jul 21, 2013 at 02:50 AM · androidtextureimagegallery

Save a Texture2D for android

I am accessing an image from android device gallery in unity made game and then assigning that image on my object as a texture2D. What I want now is to save that image(texture) so next time I start the game or the same scene I still have that image(texture) so I can use it on the same object. I can save the path to the image and load that image next time again from the gallery, but I don't want to do that because it is kind a slow for me. Is there any solution to saving the image locally in the application folder or something similar.

Thanks

Comment
Add comment · Show 2
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 AhmadMujtaba · Jul 23, 2013 at 02:49 PM 0
Share

no help. Please any one guide me to the right direction. Thanks

avatar image DeveshPandey · Jan 13, 2018 at 12:19 PM 0
Share

Here is cross platform solution to save texture to gallery. http://unitydevelopers.blogspot.in/2014/06/capture-and-save-to-camera-roll-and.html

There are 2 versions so you have freedom to select as per your need.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by shinevision · Jan 25, 2018 at 12:30 AM

Mmm. i've never tried saving an image. But you could try this:

 File.WriteAllBytes("Path/folder/MyImage.png",bytes);

You would somehow have to convert the image to a byte array.

Sorry if this isnt the answer you where looking for. But goodluck!

EDIT: you can use this to convert it to bytes:

 byte[] _bytes =_texture.EncodeToPNG();

Source: (https://answers.unity.com/questions/1331297/how-to-save-a-texture2d-into-a-png.html)

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

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

Download Image to a new album (Android) 0 Answers

Passing texture to android plugin 0 Answers

pick image from android gallery 3 Answers

How to load image from android gallery 0 Answers

Loading 8192x8192 textures at runtime on android 0 Answers


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