Rotate an image through a byte array?
Im trying to rotate an Image 90 degrees clockwise in some unity script I have. Ive looked around but cant seem to find a good answer for this. Since Unity doesnt have direct access to the bitmap classes Im unsure how to accomplish this. Ive also tried modifying the byte array but im not great at the math that would go with that. Please help.
If the image is Texture2D you can get its byte with Texture2D.GetRawTextureData.
I have the byte array already. I just need to rotate the image through the image data to send it to a web API for that to interpret.
Answer by Bigiansen · Sep 11, 2016 at 02:02 AM
How are you using a byte array to represent an image? Wouldn't it make more sense to use Color?
Rotating a bidimensional array is just swapping the x indexes for the y indexes.
Im using the byte array so that I can send the image to a web service, I dont know that color data is something a Web API would be able to interpret. and because of that I have to use the 1 dimensional byte array of the image to rotate and send it to the web api