Search Unity

Conversion to TIFF? like EncodeToTIFF()

Discussion in 'Scripting' started by Nirvan, Jan 16, 2020.

  1. Nirvan

    Nirvan

    Joined:
    Nov 16, 2013
    Posts:
    134
    I making tool to edit texture files in project and it's working.

    I have my array of pixels Color32[] setted to texture with myTexture.SetPixels32(pixels); and using them to File.WriteAllBytes(filePath, myTexture.EncodeToPNG());
    But I need possibility to do it on TIFF files.

    Maybe there is some light solution for that?

    Thanks.
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,435
  3. Nirvan

    Nirvan

    Joined:
    Nov 16, 2013
    Posts:
    134
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,435
    usually works if add that dll to your project root folder
     
    Nirvan likes this.
  5. Nirvan

    Nirvan

    Joined:
    Nov 16, 2013
    Posts:
    134
    There are needed three dlls, WindowsBase.dll, PresentationFramework.dll and PresentationCore.dll
    and then all classes are supported in visual studio.
    But sadly I can't create palette with my pixels because System.Windows.Media.Color is spamming initialization error whenever I want to assign any value to any of its variables.

    System.TypeInitializationException: An exception was thrown by the type initializer for <Module> ---> System.InvalidProgramException: Invalid IL code in <Module>:.cctor (): IL_0032: call 0x0a00000c

    Like nothing about that online for System.Windows.Media.Color
     
    Last edited: Jan 16, 2020