Search Unity

► Resize Pro ◄

Discussion in 'Assets and Asset Store' started by Arkhivrag, May 3, 2016.

  1. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Banner.png
    Resize Pro is the fastest texture resize/scale tool for Unity. Works in Editor and Run-time.

    In Editor textures can be resized directly from Project window or by using batch converter (new texture is saved in PNG or JPG formats).
    Run-time API adds ResizePro() extension method to the Texture2D class.

    Editor.png

    Note:
    Tool is already included in Texture Adjustments asset.

    v2019.3
    • Updated API allows to set generated resized texture format: RGBA32, ARGB32, RGB24, RGBAFloat or RGBAHalf.

    v2019.2
    • Compatible with Encode Pro

    v2019.1
    • Updated for Unity 2018.3

    v2018.4
    • Updated for Unity 2017.4 and Unity 2018.2

    v2018.3
    • Fixed 'black texture' problem on mobile devices.

    v2018.2
    • Updated for Unity 2018.1
    • Compatible with Linear color space
    • Improved Resize adjustment. AspectRatio can be locked by Width, Height or Max Resolution.

    v2018.1
    • Unity 2017.3 compatible

    v2017.1
    • Added Retina display support

    v1.41
    • Unity 5.5 compatible
    • Run-time API supports mipmap option.

    v1.4
    • Unity 5.4 compatible

    v1.32
    • Correct handing original texture extension (lowercase or uppercase).

    v1.3 - v1.31
    • Resized textures inside editor now can be saved as TGA files too (requires Encode To TGA plugin).
    • Generated textures now will have correct import settings.

    v1.2
    • Editor converter now can detect Bump textures and resize them correctly.

    v1.1
    • Run-time API updated. Now textures with any format can be resized, even if they are not readable.




    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Aug 10, 2019
  2. r-pedra

    r-pedra

    Joined:
    Dec 4, 2015
    Posts:
    104
  3. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    TextureScale: Only works on ARGB32, RGB24 and Alpha8 textures that are marked readable.
    ResizePro: Works with all type of textures.

    TextureScale: CPU calculation + bad memory management.
    ResizePro: GPU calculation + no memory problem.

    Most devices (even very old) support RenderTextures, so yes, ResizePro works on mobiles too.

    Here are some benchmarks.
    Benchmark.png



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: May 30, 2016
  4. r-pedra

    r-pedra

    Joined:
    Dec 4, 2015
    Posts:
    104
    WOW, nice perfs.
    Does your benchmark graph clamped to 1 second or the plugin always wait at least 1 second?
     
  5. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    After resizing pixel array is read from GPU and saved inside Texture2D. That needs some time.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: May 30, 2016
  6. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    592
    is this useful in-game or just compression on the editor ?
     
  7. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Run-time API adds ResizePro() extension method to the Texture2D class.



    VacuumShaders - Facebook Twitter YouTube
     
  8. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    592
    sorry if i sounds like a beginer could you explain further
     
  9. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Adds ResizePro function to the Texture2D class:
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. //ResizePro
    4. using VacuumShaders.TextureExtensions;
    5.  
    6.  
    7. public class NewBehaviourScript : MonoBehaviour
    8. {
    9.     public Texture2D texture;
    10.     int width;
    11.     int height;
    12.  
    13.     void Start ()
    14.     {
    15.         //ResizePro
    16.         texture.ResizePro(width, height);
    17.     }
    18. }

    VacuumShaders - Facebook Twitter YouTube
     
  10. hrjunker

    hrjunker

    Joined:
    Nov 15, 2011
    Posts:
    26
    Hi

    I am trying to use your plugin (bought it as part of TextureAdjustments) but I am not sure how to use it. I assumed it should be simple to use.

    I get an texture from a filepath using WWW, and if it is too large I want to resize it. Using TextureScale I could just use
    Code (CSharp):
    1. TextureScale.Bilinear(texture, 4096, 4096);
    So now I try using your code
    Code (CSharp):
    1. texture.ResizePro(texture.width/2, texture.height/2);
    but the texture just shows purple, as it also does when the texture is too large. Could you please guide me in the right direction?

    EDIT: The texture is resized, but the pixel information is lost. This is confirmed by writing the texture out to the disk.
     
    Last edited: Nov 2, 2016
  11. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    In the description of the WWW.texture is written that variable is Read Only. You can't modify it.

    In this case use:
    Code (CSharp):
    1. ResizePro(int width, int height, out Texture2D dstTexture)
    that returns resized texture inside dstTexture variable.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Nov 3, 2016
  12. hrjunker

    hrjunker

    Joined:
    Nov 15, 2011
    Posts:
    26
    Cannot seem to find a ResizePro function that have those arguments within the namespace VacuumShaders.TextureAdjustments or VacuumShaders.TextureExtensions. Can only find TextureResizePro.ResizePro(Texture texture, int width, int height) and TextureResizePro.ResizePro(Texture texture, int width, int height, TextureFormat format, bool hasMipMap)

    I just find it odd that you proclaim that your plugin can handle "all type of textures." when there are exceptions. Anyway if you can point me in the direction of the mentioned function that would be great!

    [EDIT] I just bought the ResizePro plugin directly, and this gives me the function with the parameters you mentioned, so there is a mismatch between the "original" and the one included in Texture Adjustments.

    Unfortunately it did not work, here is a code example which will give the error:
    Code (CSharp):
    1. WWW www = new WWW("http://kanda.dk/TestLargeImage/PANO_Field.jpg");
    2.  
    3. while (!www.isDone)
    4. {
    5.     yield return null;
    6. }
    7.    
    8. Texture2D texture = www.texture;
    9. //Max texture size on iOS
    10. int textureHeightLimit = 4096;
    11. int textureWidthLimit = 4096;
    12. //File.WriteAllBytes(Application.dataPath+"/../SavedScreenBefore.png",texture.EncodeToPNG());
    13. if (texture.height > textureHeightLimit || texture.width > textureWidthLimit)
    14. {
    15. #if UNITY_IOS || UNITY_EDITOR_OSX
    16.     //TextureScale.Bilinear(texture, textureHeightLimit, textureWidthLimit);
    17.     Texture2D theOtherTexture = new Texture2D(texture.width/2, texture.height/2);
    18.     texture.ResizePro(texture.width/2, texture.height/2, out theOtherTexture);
    19.     texture = theOtherTexture;
    20. #endif
    21. }
    22. //File.WriteAllBytes(Application.dataPath+"/../SavedScreenAfter.png",texture.EncodeToPNG());
    23. // continue and use the texture
    24.  
     
    Last edited: Nov 4, 2016
  13. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Update Texture Adjustments to v2.21, it includes latest ResizePro API.

    What exceptions? o_O
    If variable is Read Only it can not be modified directly, memory it occupies is 'locked' and can't be overwritten.

    Just tried, everything works. Texture is downloaded and saved, including resized version.
    What is the error?

    As there was no need to purchase ResizePro, I can give refund on it.



    VacuumShaders - Facebook Twitter YouTube
     
  14. hrjunker

    hrjunker

    Joined:
    Nov 15, 2011
    Posts:
    26
    Done


    I also just tested, and found out that it works if I have Standalone set as build target, but it does not work when changing to iOS or Android as build target. I thought it might just be an editor thing, but it doesn't work on devices as well. Does it only work on standalone? I do not see any platform limitations mentioned anywhere? :) Could also be some settings that I need?

    Sure lets find out, I have sent a mail friday last week, lets take that there.
     
  15. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    What you mean by 'doesn't work' ? Some errors, warnings, exceptions, crashes ? More details will be helpful.
    Also make sure target device supports RenderTextures - it is the only requirement.



    VacuumShaders - Facebook Twitter YouTube
     
  16. hrjunker

    hrjunker

    Joined:
    Nov 15, 2011
    Posts:
    26
    The problem was that I did not get any errors, so was hard for me to find the problem. However, I did find that the problem is not ResizePro, but rather the limitation of the system that was the problem. I tried with 8k texture on iOS which does not support over 4k and this also limits the plugin.

    However I did find a workaround, though it might not be pretty, it works (so far). I split the texture in 2 halfs, then resize each half and then combine them again. So having a texture of 8192 x 4096 I split in left and right each 4096 x 4096. Then resize left and right to 2048x2048. Then combine left and right to a single 4096 x 2048 image.
     
  17. skrishna

    skrishna

    Joined:
    Sep 18, 2014
    Posts:
    17
    Hi. I was wondering if this would scale Texture2D objects on iOS with BGRA32 formatting?
     
  18. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    It works with all Texture2D objects. No restriction on image format.



    VacuumShaders - Facebook Twitter YouTube
     
  19. SniperED007

    SniperED007

    Joined:
    Sep 29, 2013
    Posts:
    345
    Does this support Windows Phone 8.1 ?
     
  20. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Of course.



    VacuumShaders - Facebook Twitter YouTube
     
  21. Ben-Howard

    Ben-Howard

    Joined:
    Jul 21, 2014
    Posts:
    23
    Hello Devs, this seemed to work great, but has a memory leak issue with the following lines of code on UWP app:

    Code (CSharp):
    1. UnityEngine.WSA.Application.InvokeOnAppThread(() =>
    2.             {
    3.                 texture.LoadRawTextureData(_latestImageBytes);
    4.                 texture.Apply();
    5.              
    6.                 int quality = 2;
    7.                 Texture2D resizedTex = new Texture2D(_width / quality, _height / quality, TextureFormat.BGRA32, false);
    8.                 texture.ResizePro(_width / quality, _height / quality, out resizedTex, false);
    9.                
    10.                 _bytesJpg = resizedTex .EncodeToJPG();
    11.             }, true);
     
  22. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Do not use constructor or any kind of initialization for out parameters.
    Just use:
    Code (CSharp):
    1.  
    2. Texture2D resizedTex = null;
    3. texture.ResizePro(_width / quality, _height / quality, out resizedTex, false);
    4.  
    and do not forget to destroy texture manually after use. Unity does not release memory allocated by texture.



    VacuumShaders - Facebook Twitter YouTube
     
  23. Ben-Howard

    Ben-Howard

    Joined:
    Jul 21, 2014
    Posts:
    23
    Never mind, and apologies, this was due to my not explicitly disposing of the instantiated Texture on each call. Great asset!
     
  24. Ben-Howard

    Ben-Howard

    Joined:
    Jul 21, 2014
    Posts:
    23
    THANKS!
     
  25. YEN-LIN-WU

    YEN-LIN-WU

    Joined:
    Apr 14, 2013
    Posts:
    5
    Can you try these three picture?

    1. http://i.imgur.com/WczPabY.jpg
    2. http://i.imgur.com/mpKEqak.jpg
    3. http://i.imgur.com/e6AI1hf.jpg

    ResizePro works fine on editor, but in iOS

    1,3 is a purple texture, only 2 is success.

    This is my code

    Code (CSharp):
    1.  
    2.             var tex = new Texture2D(0, 0, TextureFormat.RGB24, false);
    3.  
    4.             ImageConversion.LoadImage(tex, bytes, true);
    5.  
    6.             var width = tex.width;
    7.             var height = tex.height;
    8.  
    9.             if( width > 2048 || height > 2048 ) {
    10.                 Debug.LogFormat("Original size = {0},{1}", width, height);
    11.  
    12.                 if( width >= height ) {
    13.                     height = height * 2048 / width;
    14.                     width = 2048;
    15.                 } else {
    16.                     width = width * 2048 / height;
    17.                     height = 2048;
    18.                 }
    19.  
    20.                 Debug.LogFormat("Resize to {0}, {1}", width, height);
    21.  
    22.                 Texture2D resizedTex = null;
    23.  
    24.                 tex.ResizePro(width, height, out resizedTex, false);
    25.  
    26.                 Destroy(tex);
    27.  
    28.                 return resizedTex;
    29.             }
    30.  
    31.             return tex;
     
  26. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    iOS can not handle more than 4K textures. It's hardware limitation.
    1 and 3 textures resolution is more than 4K and that's why conversion fails.



    VacuumShaders - Facebook Twitter YouTube
     
  27. YEN-LIN-WU

    YEN-LIN-WU

    Joined:
    Apr 14, 2013
    Posts:
    5
    But TextureScale can scale successfully.
    Is there some way I can scale texture more than 4K by using ResizePro?
     
  28. WhiteGfx

    WhiteGfx

    Joined:
    Apr 10, 2017
    Posts:
    16
    Hi on Android Huawei P8 lite and Huawei Y6 Im getting black or grey textures after resize. On Lenovo K6 (K33a48)
    For sure I test small textures 1024x1024 and still same, black/gray textures, no errors or exceptions.

    Do you have any tip how to debug?

    Regarding what device must support... "Most devices (even very old) support RenderTextures, so yes, ResizePro works on mobiles too."

    Render texture support must be tested for specific texture not only for if supported in general, see the obsolete API.
    During the import of your asset there is automatic API update on your dll assembly. Without source code I cant see what changed and cant debug. So for now I cant use it.

    I used following code to decide if scale on gpu can be done(_newWidth, _newHeight is smaller than input texture):

    Code (CSharp):
    1.  
    2.             Texture2D _scaledTex = new Texture2D(_newWidth, _newHeight, TextureFormat.RGB24, false);
    3.             bool supportRenderTexture = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGB32);
    4.             bool maxSizeSupported = Mathf.Max(_inputTex.width, _inputTex.height) < SystemInfo.maxTextureSize;
    5.             bool scaleOnGpu = false;
    6.             if (maxSizeSupported && supportRenderTexture)
    7.             {
    8.                 scaleOnGpu = true;
    9.             }
    10.             UnityEngine.Debug.Log("supportRenderTexture " + supportRenderTexture + " maxSizeSupported " + maxSizeSupported + " " + _inputTex.width + "/" + _inputTex.height);
    11.  
    12. .. later
    13.  
    14.           if (scaleOnGpu)
    15.             {
    16.                 UnityEngine.Debug.Log("scale using ResizePro");
    17.                 TextureResizePro.ResizePro(_inputTex, _newWidth, _newHeight, out _scaledTex);
    18.             }
    19.             else
    20.             { // bilinear scale code
    21.             }
    22.  
    23. // later _inputTex is destroyed and function return _scaledTex;
    24.  
    thank you for your support
     
  29. kenmarold

    kenmarold

    Joined:
    Jun 11, 2015
    Posts:
    27
    I'm trying to resize (scale down) a texture2d before compressing it and sending over the network but the resulting texture2d is empty (it just loads as solid gray). How am I using tex.ResizePro(16, 16, out texResized); incorrectly?

    Code (CSharp):
    1. using System;
    2. using System.Collections;
    3. using UnityEngine;
    4. using UnityEngine.UI;
    5. using UnityEngine.Networking;
    6. using VacuumShaders.TextureExtensions;
    7.  
    8. [Serializable]
    9. public class PlayerObject
    10. {
    11.     public byte[] texBytes;
    12.     public int texWidth;
    13.     public int texHeight;
    14.     public TextureFormat texFormat;
    15.  
    16.     public float tranX;
    17.     public float tranY;
    18.     public float tranZ;
    19.     public string type;
    20.     public string id;
    21.     public int strength;
    22.     public int hitpoints;
    23. }
    24.  
    25. public class Player_Data : NetworkBehaviour
    26. {
    27.     public static Player_Data instance = null; // create singleton
    28.  
    29.     PlayerObject playerObj = new PlayerObject();
    30.  
    31.     private Texture2D texResized;        // resized texture
    32.     private byte[] texBytes;            // texture byte array
    33.     private byte[] compressedTexBytes;    // compressed bytes
    34.  
    35.     public Vector3 tran;
    36.     private int strengthToSend = 80;
    37.     private int hitPointsToSend = 2;
    38.  
    39.     private void Awake()
    40.     {
    41.         if (instance == null)
    42.             instance = this;
    43.         else if (instance != this)
    44.             Destroy(gameObject);
    45.     }
    46.  
    47.     [Client]
    48.     public void PrepareServerData(Texture2D texToSend, string typeToSend)
    49.     {
    50.         StartCoroutine(DoResizeTexture(texToSend));
    51.         StartCoroutine(DoGetRawTextureData(texResized));
    52.         StartCoroutine(DoSendData(typeToSend));
    53.     }
    54.  
    55.     IEnumerator DoResizeTexture(Texture2D tex)
    56.     {
    57.         tex.ResizePro(16, 16, out texResized);
    58.         yield return new WaitForEndOfFrame();
    59.     }
    60.  
    61.     IEnumerator DoGetRawTextureData(Texture2D tex)
    62.     {
    63.         texBytes = tex.GetRawTextureData();                      // comvert texture to raw bytes
    64.         compressedTexBytes = lzip.compressBuffer(texBytes, 1);   // compress texture byte array
    65.         yield return new WaitForEndOfFrame();
    66.  
    67.         GameObject infoDisplayText = GameObject.Find("InfoDisplay");
    68.         infoDisplayText.GetComponent<Text>().text += "Bytes to send : " + playerObj.texBytes.Length + "\n";
    69.     }
    70.  
    71.     IEnumerator DoSendData(string typeToSend)
    72.     {
    73.         Player_Spawn spawn = GetComponent<Player_Spawn>();
    74.         tran = spawn.GetPlayerPos();
    75.  
    76.         playerObj.texBytes = compressedTexBytes;
    77.         playerObj.texWidth = texResized.width;
    78.         playerObj.texHeight = texResized.height;
    79.         playerObj.texFormat = texResized.format;
    80.         playerObj.tranX = tran.x;
    81.         playerObj.tranY = tran.y;
    82.         playerObj.tranZ = tran.z;
    83.         playerObj.type = typeToSend;
    84.         Player_ID id = GetComponent<Player_ID>();
    85.         playerObj.id = id.MakeUniqueIdentity();
    86.         playerObj.strength = strengthToSend;
    87.         playerObj.hitpoints = hitPointsToSend;
    88.  
    89.         Network_Serializer serialize = GetComponent<Network_Serializer>();
    90.         byte[] bytes = serialize.ObjectToByteArray(playerObj);
    91.  
    92.         yield return new WaitForEndOfFrame();
    93.  
    94.         StartCoroutine(Network_Transmitter.instance.DoSendBytes(0, bytes));
    95.     }
    96. }
     
    Last edited: Nov 6, 2017
  30. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Just to make sure ResizePro works with coroutine:
    Code (CSharp):
    1. using System.Collections;
    2. using UnityEngine;
    3.  
    4. using VacuumShaders.TextureExtensions;
    5.  
    6. public class NewBehaviourScript : MonoBehaviour
    7. {
    8.     public Texture2D texOriginal;
    9.     public Texture2D texResized;
    10.  
    11.     // Use this for initialization
    12.     void Start ()
    13.     {
    14.         StartCoroutine(DoResizeTexture(texOriginal));
    15.     }
    16.  
    17.     IEnumerator DoResizeTexture(Texture2D tex)
    18.     {
    19.         tex.ResizePro(16, 16, out texResized);
    20.         yield return new WaitForEndOfFrame();
    21.     }
    22. }


    VacuumShaders - Facebook Twitter YouTube
     
  31. unitycodergp

    unitycodergp

    Joined:
    Feb 1, 2017
    Posts:
    47
    Hi,

    I have this message : Feature `declaration expression' cannot be used because it is not part of the C# 4.0 language specification.

    Regards.
     
  32. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    What is Unity version and build target?



    VacuumShaders - Facebook Twitter YouTube
     
  33. Danua

    Danua

    Joined:
    Feb 20, 2015
    Posts:
    197
    Hello, your asset will work with unity 2017.3.f3? And support tiff with zip compression?
     
  34. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    It works in Unity 2017.3.0f3.
    Editor exports resized textures in PNG and JPG file formats. And in TGA if this plugin is installed.



    VacuumShaders - Facebook Twitter YouTube
     
  35. moldywarpe

    moldywarpe

    Joined:
    Jan 18, 2017
    Posts:
    31
    Hi, Interested in ResizePro to scale down dynamically loaded images. I note that someone questioned the use of this under .Net 4+.
    Can you confirm that this will work under 2017.3.0f3 with .Net 4.6 thanks.
     
  36. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Fully compatible with 2017.3.0f3
    Developed with .Net 3.5 and have not found any problems using with .Net 4.6



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Jan 6, 2018
  37. moldywarpe

    moldywarpe

    Joined:
    Jan 18, 2017
    Posts:
    31
    Works well - very happy - bought ;).
    Tested using 2017.3.0f3 and .Net 4.6.

    Now what can you provide to speed up Unity's EncodeToPNG() :rolleyes:
     
    Arkhivrag likes this.
  38. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    460
    Hey, does it use any kind of interpolation when scaling? For example, when scaling with GIMP I can select different interpolation types: linear, cubic, sinc.

    Thank you
     
  39. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Simple rescaling, no interpolations options to choose from.



    VacuumShaders - Facebook Twitter YouTube
     
  40. Miscellaneous

    Miscellaneous

    Joined:
    Sep 24, 2013
    Posts:
    53
    Your Asset page mention:
    * Has no limit on texture formats and works even with textures that aren't Read/Write enabled.

    But after purchasing, your document says:
    * Texture must be readable and in uncompressed format.

    Wouldn't uncompressed textures on Mobile be useless? Anyhow, it seems misleading...

    p.s your support email goes to a Facebook page where messages are disabled, will count the hours for a reply here!
     
  41. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Included documentation describes two methods:
    If texture is unreadable (locked in memory) use the second method, after that destroy original texture.
    Resized texture will be in dstTexture.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Feb 24, 2018
  42. syalanurag1991

    syalanurag1991

    Joined:
    Aug 29, 2017
    Posts:
    2
    Resize Pro not working in Unity 2017.2. I keep seeing this error message in the console:

    TypeLoadException: Could not load type 'VacuumShaders.TextureExtensions.ImportSettings' from assembly 'VacuumShaders.ResizePro_Editor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
    UnityEditor.Build.BuildPipelineInterfaces.InitializeBuildCallbacks (BuildCallbacks findFlags) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:122)

    What can I do to make this work in Unity 2017.2 upload_2018-4-17_21-12-30.png
     
  43. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    When using Unity 2017.2 asset store downloads version for Unity 5.4
    Try Unity 2017.3
    (There are two versions of the asset on the store, for Unity 5.4 and Unity 2017.3)



    VacuumShaders - Facebook Twitter YouTube
     
  44. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,943
    How can i resize an texture to either maxwidth = 1000 or maxheight = 1000 (which is bigger) by maintaining aspect ratio?

    so if an image is bigger like 2400x3000, it set its height to 1000 and width accordingly

    Thanks
     
  45. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    Update will be available tomorrow.



    VacuumShaders - Facebook Twitter YouTube
     
    jGate99 likes this.
  46. theolagendijk

    theolagendijk

    Joined:
    Nov 12, 2014
    Posts:
    117
    Hi @Arkhivrag,
    Yesterday I bought both ResizePro and Texture Adjustments. Both great assets, thanks!
    What would you advise to do when (at runtime) you get an image file larger than 4k that needs to be scaled down to a size that fits a Texture2D. Is there an approach that you would recommend?
     
  47. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    ResizePro is Unity Texture2D extension and to use it on image it must be Texture2D object.
    If you have some byte[], stream, etc containing image data ResizePro can not help. Unfortunately I can not recommend anything to resize such data. May be google for some appropriate methods.



    VacuumShaders - Facebook Twitter YouTube
     
    theolagendijk likes this.
  48. theolagendijk

    theolagendijk

    Joined:
    Nov 12, 2014
    Posts:
    117
    Thanks Arkhivrag,
    I understand the scope of your product. And I'm very happy with the ResizePro Texture2D extension.
    Because of the 4k texture limitation on iOS I had an app working perfectly inside the editor but not on iOS devices. I saw no solution inside Unity C#. I now wrote a native iOS plugin to do the image resizing. Works perfectly but if you knew of an approach that would work without native plugins that would have my preference.
     
  49. SniperED007

    SniperED007

    Joined:
    Sep 29, 2013
    Posts:
    345
    Doesn't appear to be working on mobile in Unity 2018.1.2f1 running in Linear Color Space on Android. Tested on Samsung Galaxy S8+.

    TextureResizePro.ResizePro(photoTaken, 216, 384, false);
     
  50. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,981
    What exactly does not work? If ResizePro can not resize image it prints detail info about that.



    VacuumShaders - Facebook Twitter YouTube