- Home /
Texture compression is broken?
I have a jpg file that is 500kb and no matter which compression I pick in unity, the file size will always be bigger than 500kb and yet the image itself will look worse in most cases. What's up with this?
Also which compression method is losless? I need perfect quality image.
Thanks
Don't use JPG if you can avoid it. It's lossy, and the source format is never used in Unity.
Answer by Ashkan_gc · Jun 03, 2011 at 09:09 PM
all compressions in unity are losless i think. the image size does not depend on the source format. when you import it into unity it's a set of pixels which unity stores in it's internal formats. each format stores properties of textures in a specific number of bits. you can adjust the resolution for making it smaller. jpeg is an advanced compression method and is lossy. it uses different algorithms. when you import a 32X32 image it's 32*32 pixels which will be stored in unity either as rgb or argb values. if not compressed each component (e.g R) takes 8 bits. there is much info about it in texture import settings in unity's manual.
DXT and PVRTC are quite lossy, but they have a fixed size.
Answer by Eric5h5 · Jun 03, 2011 at 10:05 PM
None of the compression formats are lossless. If you need perfect image quality, the only choices are RGB24 if you have no alpha, or ARGB32 if you do have alpha. Don't use lossy formats like JPG for the source either, use lossless like PSD, TGA, etc.
Answer by DaveA · Jun 03, 2011 at 09:24 PM
See Ashkan's answer, but also try either setting max size larger, or set it to a GUI texture which will use the original size
Answer by Wolfram · Jun 03, 2011 at 10:30 PM
See Eric's and my answers here: http://answers.unity3d.com/questions/121684/texture-file-size-in-unity.html