Material texture filetype conversion (TGA to PNG)

Hi! I’m a beginner, so…

Is there a way to change the extension of all textures in the model, for example, i need to change them from TGA to PNG, because when I open them in Photoshop TGA opens as JPG and I lose not only quality but also the alpha channel:)

Is there a plugin or built-in ability to see a list of all the materials involved in the model?

Extension Warehouse search with term material

The first one, Material Replacer, seems rather promising?

I’d second “material replacer”, I find I use it on most jobs. It doesn’t work from the materials list but by selecting a material in the model space with an eye dropper and then selecting the material to replace it. It will update all instances of that material through the model. In the example I am changing one texture that is a jpg to a png.

Open the Materials inspector panel (it’s likely in the Default Tray unless you’ve moved it to a custom tray.)

Above the list you’ll see a little house icon. That is the “In Model” collection button. It switches to view the materials that are in the model’s materials collection. (The other views are viewing collection folders on disk.)

All the model resource collection inspectors work like this regarding the “house” button.

I have hundreds of textures in the model, they are all in tga. I need to change all of them to PNG extension. This is very inconvenient and takes a very long time by loading and replacing with new textures. So these plugins will not help.

Thanks! At least I can replace the textures manually through this option …

But still, changing the extension of all the files in the project is apparently not possible. For example, in 3dmax there is a plugin that allows you to do this. It is very comfortable. It is strange that no one has encountered this problem for so many years. An alternative solution would be a small plugin that would allow exporting the TGA format without conversion to JPG. (It seems that TGA is the only format that is subjected to such mockery :slight_smile:

Yes it’s possible. I’m working on a little plugin that can do this right now.

Can you PM me a model with some of these materials in the “In Model” collection ? You can erase the geometry to lighten it up, and then purge the components via the Components inspector’s Details menu. (Don’t “Purge All” via the Model Info Statistics panel, because that will purge the Materials as well.)

Draw a simple cube in place of the model geometry and give a new name “TestTextureConvert.skp” or similar.

If it’s of use, this online converter seems to work, other than the image came back upside down.

No this is not what im talking about.

You can convert an image from one format to another in hundreds of ways, converters.

I mean the situation when the texture was added to the project in Sketchup has the TGA format and, for example, has an alpha channel, if I click on the button to open the texture in a third-party editor (the button that is on the materials board, the editor in which this texture will open is setting up in the preferences in the sketchup ). So it opens in Photoshop in JPG format, i.e. the sketchup cannot export TGA without conversion, it is a pity that it does not convert at least to PNG, the loss of image quality and alpha channel is very inconvenient.

Therefore, the only way is to change all textures in the project extension to PNG. Cause after it they opens as PNG and there are no losses, you edit the texture, save it, then add it back to the project.

if your original targa has alpha i.e. 32 bit, FreeImage inside SU converts it to RGBA and SU exports it as PNG, if it has no alpha i.e. 24 bit it is converted to RGB and exports as JPG @ 100% quality…

if you are losing detail it is because photoshop is imposing compression, which you should be able to set/adjust…

I avoid PS because it also adds lots of metadata, that then bloats SU [even though it goes unused]…

do the originals have alpha?

john

Yes. Originals have alpha, and SKP specification info says it cant export TGA, this is the only format which is converts to JPG. PNG opens as PNG.

I have already converted all textures to png format, but I have projects with many textures in tga. The most convenient thing would be to do, as does Dan. Mini-tool or plugin which can convert textures right in the project. This would be fantastic, right as in 3dmax’s “change texture extension” script which allows to change any texture to variety of formats like jpg, bmp, tga, dds and so on in 1 click.

I did a test. If you take what you want and make it be part of a collection, that is, you have skm files, they are zip files. Renamed a skm to .zip, unzip it, and in the ref folder is your original tga file.

@colin try editing that one in PS from SU edit materials window…

john

Yes, yes, you get the point. So the problem is here:

I have an alpha channel texture, for example the plant. I have made an object from it and i can use it onto rendering(flowers, branches etc.). But sometimes i need to edit it in PS. So then i push the button in SKP material window it appears in PS window immediately, which is very convenient for editing materials. The problem is that it opens in jpg format, I didnt know for sure if the image quality is lost due to this, but there is definitely no alpha channel there. Although in the texture that is currently in the sketchup, the alpha channel is of course exist and it has .tga extension on material info tab.

upload a sample targa [maybe zip it first, to avoid a conversion]…

john

Just make a test, the same problem on any 32 bit targa file with alpha-channel. It appears as jpg in PS. PNG appears as PNG. Also my PS picked up this disease and stopped saving the alpha channel when saving to PNG. (fixed)

I know how to make it fail, I was showing how to get the tga out of the skp. Strangely, when I try to remake an skm after editing the tga, I can’t get SketchUp to see the new version.

if you import and save as skm, SU creates a .skm with the ‘original’ format appended, but actually runs using a converted RGBA which it sends to openGL…

when you use SU material edit function:

SU creates a copy to Temp and instructs the editor to open that file…

this is where the conversion is happening…

I see a .jpg in the temp folder when editing a 32 bit .tga…

BUT:
if I use ‘Make Unique’ first, I see a png in temp and CAN modify keeping alpha…

john

I do this through a button on the materials panel. Like on attached screenshot In a zip. By clicking on the button, the file immediately opens in PS (since it is specified in the sketchup settings as a third-party editor, I tried other editors, they also open tga files as jpg). Im not exporting it any other way because this is the only good and fast method for quick editing the textures. If you going to export it through tab file\export\2d you can also see that there is no tga format in the list in SU.
skp.zip (66.2 KB)

I think you have uncovered a bug as it also happens on my mac…

when you use dlg_external_texture_editor SU creates a temporary image file that it ‘sends’ to your editor…
when your editor is finished it updates that temporary image and SU replaces the ‘in model’ texture with the new image…

the issue is SU is converting the ‘temporary’ image to .jpg before sending it to the editor…

I painted 3 faces with a material that use a .tga image…

the first is un-edited…

in the star example the targa, was automatically converted to jpg by SU when creating the temp file…

it shows a sky blue mask in the editor and back in SU…
IceAlpha_tga
the polygon example the targa was converted to .png by me using
Right Click >> Texture >> Make Unique before using dlg_external_texture_editor in the materials panel…

If you export the file to .dae with ‘Export Texture Maps’ it exports all 3 image formats…

IceAlpha_tga.skp (5.0 MB)

john