Search code examples
c#imagematrixrotationimage-scaling

2D pixel array rotation and scaling


I am working on a C# program to process images ( given as int[,] )..

I have a 2D array of pixels, and I need to rotate them around a point, then scale them down to fit the original array. I already found articles about using matrix to transform to a point and rotate then transform back. What remains is to scale the resultant image to fit an array of original size.

How that can be done? (preferably with 2 equations one for x and one for y )


Solution

  • Have a look here. That should give you all the math behind doing coordinate rotations.