Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

I want to bulk convert some textures from .tga to .png and update references

Discussion in 'Editor & General Support' started by dustinfreeman, Mar 2, 2018.

  1. dustinfreeman

    dustinfreeman

    Joined:
    Apr 9, 2015
    Posts:
    18
    I have an asset pack I'm prototyping with that uses some high-quality tga textures, at 2048x2048. There are 250 of them, which means my Asset folder is huge. I know that for some rendering cases, .tga is better than .png, but for my use case, portability is more important than texture quality.

    I want to convert all these .tga into .png, and then update all Material references to use the new .pngs. Deleting the old .tga is totally fine - I don't need to preserve them. I know how to bulk-convert images easily; I just want to update the references in the .mat files to use the new textures.

    The textures are all used in materials which use the Standard Shader, and are either used for fields Albedo, Metallic, Normal Map, or Occlusion. There's no weird custom shaders I need to update references for.

    Is there an automated way to do this?
     
    radiantboy likes this.
  2. dustinfreeman

    dustinfreeman

    Joined:
    Apr 9, 2015
    Posts:
    18
  3. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    great thanks, I want to do this right now, im finding 256 meg tga files that need to be reduced in size dramatically! its interesting that unity doesnt care about the extension, hopefully this will save me a ton of space :) Im confused why artists use tga in the first place, any ideas?
     
  4. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    714
    Just wanted to suggest the Python PIL library for this kind of automation.