0

I'm trying to pass a static Texture2D asset to a library, but it expects RGB24, RGB32, or RGB32A only. Those are uncompressed, so storing my texture in that format isn't really an option, it'd be enormous.

If I have my Texture2D stored in a compressed format, how can I convert it to RGB24 (or RGB32) in memory?

I know how to create a new Texture with the right format and size, I just don't know how to move the image data without a shader and rendertarget and so on, but I assume there's a quicker and easier way.

So, in C#, how to convert a compressed Texture Asset to in-memory RGB24?

glennsl
  • 28,186
  • 12
  • 57
  • 75
Dave
  • 1,521
  • 17
  • 31

1 Answers1

0

First mark your texture as read/write in the import settings. Then you can use Texture2D.GetPixels32 to retrieve pixel data. If your library doesn't support the default format unity provides with Color32 (it's either ARGB or RGBA, can't remember) you'll have to convert it manually.

Arshia001
  • 1,854
  • 14
  • 19