How do you straighten an image in Delphi?
I have always wondred of how they do this magic… straighten an image that is. Well as it turns out, no magical skills is needed. All that is needed is to crop the rotated image.
One question, I have not found a fully acceptable answear to yet, is how to calculate this area. My solution uses the four rotated corners of the image. This works and is acceptable but it loses more than needed of the image when the angle increases.
I have included a demo project that shows my solution. Do take a look at it and if you find any bugs or improve it in any way, I would love to hear about it.
Download: Demo including source