Image size increase on loading in memory from local storage?
Hey, I'm loading a jpg Image from local storage in a rawImage variable. The actual size of image is 412kb but when it is loaded in memory its size raise 7.7mb. This is taking a lot of memory on iOS. i have used the following code snippet to load the image.
Texture2D newTexture = new Texture2D(2, 2, TextureFormat.RGB24, false); newTexture.anisoLevel = 1; newTexture.filterMode = FilterMode.Bilinear; newTexture.wrapMode = TextureWrapMode.Clamp; newTexture.LoadImage(File.ReadAllBytes(path)); _image.texture = newTexture;
Can anyone please help get out of this issue? Is there any way to apply compression to image or there is some other thing that I am missing?
Thanks,
Answer by AurimasBlazulionis · Oct 28, 2016 at 09:03 PM
You should use Texture2D.Compress. I have not tried this, but it should work. Other than that, there are not really any other options.
Your answer
Follow this Question
Related Questions
Cannot change texture size 0 Answers
IOS App bigger than Android app 0 Answers
Texture is bad on device 0 Answers
Texture Becomes Blotchy in Unity 0 Answers