Search Unity

Image scaling

Discussion in 'Scripting' started by Nexus, Apr 29, 2008.

  1. Nexus

    Nexus

    Joined:
    Apr 2, 2008
    Posts:
    13
    Hi,

    I'm just trying to scale images without using the import settings dialog. I checked .net 2.0 to find a suitable library to implement it and I found "System.drawing" library, however it seems is not yet full supported in mono.

    Has someone any idea to solve this?

    Thanks in advance
     
  2. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    What do you actually want to do?

    One way to do scaling would be to read pixels from existing texture (GetPixels), compute up/down-scaled version and set the new pixels on a new texture (or resize original texture and set pixels).

    There's a myriad and three ways to do actual scaling of course, starting from no fildering, bilinear, bicubic, all the way up to Mitchell, Lanczos and biawesome filters.
     
  3. Nexus

    Nexus

    Joined:
    Apr 2, 2008
    Posts:
    13
    I thought about such possibility, but as I'm not an specialist in image processing I had no clues about which algortihms were the best suited. I were thinking in implementing this technique: http://www.seamcarving.com/ but I found it did not fit in our requirements.

    Well, then I will google Mitchell, Lanczos etc to find the way to implement them.

    Just one question if it can be answered. Which scaling way is implemented in unity?
     
  4. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Simple bilinear.