- Home /
Image resize and save
Hi. I have a problem with resize images and save then. I get the images from www and write on the filesystem. Ok, it works. But, when I resize the image and save. It does not works. I've tried it so many ways . But, none of then works.
The piece of code where I save the image:
FileUtils.WriteFile(IMAGE_DIRECTORY_HIGH_RES + filename,www.bytes,true);
Texture2D texture = www.texture; texture.Resize(100,100); texture.Apply();
FileUtils.WriteFile(IMAGE_DIRECTORY_LOW_RES + filename,texture.EncodeToPNG(),true);
tmpShoes.LowResTexture.LoadImage(FileUtils.LoadFile(IMAGE_DIRECTORY_LOW_RES + filename, true));
I forgot to say. When I use the EncodeToPNG() method, the saved image becomes black with some colored lines. And the FileUtils class belongs to a own framework that works fine.