Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
How does the programming behind transforming a picture work?
4 points by dmak on Feb 8, 2013 | hide | past | favorite | 4 comments
I'm interested in what happens when you "Free Transform" an image in photoshop. It allows you to skew the image into a perspective, resize, rotate, and so on. How does the programming behind that work?


If you're mathematically inclined, look at: http://en.wikipedia.org/wiki/Transformation_matrix

For a less technical description: The pixel values in the transformed image are generated as a function of the pixel values in the input image. Once you have the transformation function figured out, the rest is basic algebra.

If you want to get an idea of what these functions look like, flip to the "Examples in 2D graphics" section in the above Wikipedia link. There's examples there for rotation, resizing, shearing, and others.


Wow, thanks for the info. I always liked proof based math more than the applied math. Linear Algebra is going to be a lot more interesting now.


I never thought that learning Linear Algebra would be useful until today.


Computer animation is just about the only thing I've used calculus for outside of school. So yeah, I hear you. :-)




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: