► Texture Converter ◄

2601541--942103--Cover.jpg

Purchase Here

Editor tool for converting any type of Unity Texture2D object into JPG, PNG, TGA or EXR format files.

Works with textures that are not Read/Write enabled.

Supports batch converter.

Generated textures can be saved anywhere on the hard drive, inside or outside a project.

Already included in ResizePro and Texture Adjustments.

2601541--942109--Editor.jpg

Amazing Assets - YouTube Facebook Twitter

Hi there,

I've purchased this package recently, and it seems that .EncodeToTGA does not encode images with an alpha channel, which was my primary reason for purchasing this package. I can export to .png with it's indexed alpha, but I want a discreet channel for editing in Photoshop.

Please help

Thanks


It does encode in RGBA format - includes Alpha channel as separate layer.

Amazing Assets - YouTube Facebook Twitter

Hmm ok it is there, it just doesn't show up in Maya's fcheck image tool.

Any ideas why this would be different from .tga images saved from photoshop?


I'm using standard TGA save format, may be Photoshop adds something else?
The main goal of this asset is to save Alpha channel separately that is not allowed in PNG and JPG.

Amazing Assets - YouTube Facebook Twitter

how to Load TGA for file in runtime?


As written in ReadMe file (Doc folder):
[quote]
Encode texture to TGA file during run-time

public byte[ ] EncodeToTGA() - Encodes texture into TGA format.
The returned byte array is the TGA "file". You can write them to disk to get the TGA file, send them over the
network, etc.

The EncodeToTGA extension method can be brought into scope with this using directive:
* (c#) using VacuumShaders.TextureExtensions;;
* (java) import VacuumShaders.TextureExtensions;

The EncodeToTGA extension method is added to the UnityEngine Texture2D class.
[/quote]

Example:

using UnityEngine;

using VacuumShaders.TextureExtensions;


public class NewBehaviourScript : MonoBehaviour
{
    public Texture2D tex;

    void Start ()
    {
        // Encode texture into TGA
        byte[] bytes = tex.EncodeToTGA();

        //Write to a file in the project folder
        System.IO.File.WriteAllBytes(Application.dataPath + "/../Sample.tga", bytes);
    }
}

Amazing Assets - YouTube Facebook Twitter

can you please specify supported platforms ?


Works exactly the same way as EncodeToJPG and EncodeToPNG. Supports same platforms (I'm sure ALL).

Amazing Assets - YouTube Facebook Twitter

@Arkhivrag does this asset support runtime .psd to Texture2D (or any intermediate format assignable at runtime)? Does it handle flattening of layered .psd files?


No, plugin extends Unity built-in texture encode methods only.

Amazing Assets - YouTube Facebook Twitter

1 Like


Does this mean, that EncodeToTGA method from this plugin will not be available when using Unity 2017.4?


In Unity 2017.4 this plugin offers EncodeToTGA method.

Amazing Assets - YouTube Facebook Twitter

Hi there.

I want to fast EncodeToJPG.

is this asset possible?

In Runtime


Conversion speed depends on CPU, for example here are results on my PC for highest JPG quality:
4096 x 4096 - 0.507187 sec
2048 x 2048 - 0.130932 sec
1024 x 1024 - 0.040102 sec

Works in run-time.

Amazing Assets - YouTube Facebook Twitter


Can't answer for this asset, but as I had a similar question (see above): For windows only I went the route and used https://github.com/dlemstra/Magick.NET . Not as straightforward as a unity plugin available just as import & use, but image conversion wise magick.net (or to be more precise imagemagick) really seems the most powerful and still well licensed library (Apache 2.0) I've found. If I would need to go multiplatform with this code I am pretty sure this is where I would start, simply because it's an insanely well maintained library with a huge feature set.