Open BlueBatSamurai opened 6 months ago
@JannisX11
If that help, I can offer the code I have laying around written in C# to write uncompressed TGA image in 32-bit format.
Sidenote: If possible, it would be also nice to be able to choose which texture format to use during the "Create Texture" action. If you prefer separate issue for that I can create one :)
writer.Write((byte)0); // IdLength
writer.Write((byte)0); // ColorMap Type
writer.Write((byte)2); // DataType Code (2 = uncompressed)
writer.Write((short)0); // ColorMap Origin
writer.Write((short)0); // ColorMap Length
writer.Write((byte)0); // ColorMap Depth
writer.Write((short)0); // Origin X
writer.Write((short)0); // Origin Y
writer.Write((short)data.Width); // Width
writer.Write((short)data.Height); // Height
writer.Write((byte)32); // Bits Per Pixel
writer.Write((byte)(1 << 5)); // Image Descriptor
var index = 0;
for (var y = 0; y < data.Height; ++y)
{
for (var x = 0; x < data.Width; ++x)
{
writer.Write(data.Bytes[index + 2]); // B
writer.Write(data.Bytes[index + 1]); // G
writer.Write(data.Bytes[index + 0]); // R
writer.Write(data.Bytes[index + 3]); // A
index += 4;
}
}
writer.Write((uint)0); // Extension Area
writer.Write((uint)0); // Developer Directory
// Signature
writer.Write("TRUEVISION-XFILE.\0"); // string must be null-terminated hence \0 at the end
@pmatyja
Sidenote: If possible, it would be also nice to be able to choose which texture format to use during the "Create Texture" action.
Yes, that would probably be useful. Maybe there should be a setting of each texture, whether it's PNG or TGA, which is also shown in the texture properties. And then there should also be an image action to convert a texture to the other type.
Or would it be easier if all textures were PNG in the model data and only converted to TGA when saved?
Hmm, no, that probably wouldn't work when you have a TGA texture linked to a file...
Sorry, but I don't really know about the differences of PNG and TGA file codings…
Actually, when I started creating Bedrock resource packs, I thought that you could simply "convert" a texture by changing the extension in the file name... (But I soon learned that it's not that easy.)
Would love to see this implemented. My kid wants to get into making texture packs and she's pretty sharp with this stuff but having to mess with file conversion is a pain when the rest of the program makes creating and exporting skins and textures so easy.
Detailed description of your suggestion
Could you please add an option to save a texture as a TGA file instead of PNG? (For example as a second option in the "file typ" dropdown in the save dialog?)
When I made a Bedrock Edition resource pack with TGA textures, I had to save them as PNG and then convert them to TGA with Paint.NET.
Why can you open a TGA file in Blockbench but then only save it as PNG?