Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

► Texture Converter ◄

Discussion in 'Assets and Asset Store' started by Arkhivrag, Apr 19, 2016.

  1. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,993
    Cover.jpg


    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.

    Editor.jpg



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Oct 22, 2021
  2. techartandy

    techartandy

    Joined:
    Mar 8, 2015
    Posts:
    2
    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
     
  3. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,993
    It does encode in RGBA format - includes Alpha channel as separate layer.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Oct 22, 2021
  4. techartandy

    techartandy

    Joined:
    Mar 8, 2015
    Posts:
    2
    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?
     
  5. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,993
    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
     
    Last edited: Oct 22, 2021
  6. anjing010

    anjing010

    Joined:
    Jan 10, 2018
    Posts:
    1
    how to Load TGA for file in runtime?
     
  7. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,993
    As written in ReadMe file (Doc folder):
    Example:
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3.  
    4. using VacuumShaders.TextureExtensions;
    5.  
    6.  
    7. public class NewBehaviourScript : MonoBehaviour
    8. {
    9.     public Texture2D tex;
    10.  
    11.     void Start ()
    12.     {
    13.         // Encode texture into TGA
    14.         byte[] bytes = tex.EncodeToTGA();
    15.  
    16.         //Write to a file in the project folder
    17.         System.IO.File.WriteAllBytes(Application.dataPath + "/../Sample.tga", bytes);
    18.     }
    19. }
    20.  
    21.  



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Oct 22, 2021
  8. narf03

    narf03

    Joined:
    Aug 11, 2014
    Posts:
    223
    can you please specify supported platforms ?
     
  9. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,993
    Last edited: Oct 22, 2021
  10. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    @Arkhivrag does this asset support runtime .psd to Texture2D (or any intermediate format assignable at runtime)? Does it handle flattening of layered .psd files?
     
  11. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,993
    No, plugin extends Unity built-in texture encode methods only.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Oct 22, 2021
    MNNoxMortem likes this.
  12. Grosnus

    Grosnus

    Joined:
    Mar 4, 2015
    Posts:
    17
    Does this mean, that EncodeToTGA method from this plugin will not be available when using Unity 2017.4?
     
  13. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,993
    In Unity 2017.4 this plugin offers EncodeToTGA method.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Oct 22, 2021
  14. Kimsanggu

    Kimsanggu

    Joined:
    Mar 16, 2015
    Posts:
    1
    Hi there.

    I want to fast EncodeToJPG.

    is this asset possible?

    In Runtime
     
  15. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,993
    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
     
    Last edited: Oct 22, 2021
  16. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    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.