Vampyre Imaging Library Forum

Imaging Category => Help & Questions => Topic started by: dec on 19 January 2013, 18:13:49

Title: Black background when rotate an image
Post by: dec on 19 January 2013, 18:13:49
Hello,

First of all, thank you very much for your work at Vampyre Imaging Library, in my opinion one of the best tools to work with images from Delphi. I have a question that cannot solved by myself. When rotate an image (supose a Bitmap) using "Imaging.RotateImage()", we have some option in order to set the background color instead get the "default" black background?

Thank you very much in advance.
Title: Re: Black background when rotate an image
Post by: dec on 29 January 2013, 16:31:00
Hello there,

I continue needed some help with the above question. Can somebody help me? Thanks!
Title: Re: Black background when rotate an image
Post by: Galfar on 15 February 2013, 01:52:48
Hello,
unfortunately it's not possible to set the background color with currently implemented rotation method.
One option is to blend the rotated image to another image filled with desired background color.
Image to be rotated must be converted to some format with alpha channel - background after rotation will
be not only black but also transparent.

Check out Deskew for code to merge image with background:
https://bitbucket.org/galfar/app-deskew/src/d9ee5df8742884404bf8df06ed7e0b2aab88ee8f/ImageUtils.pas?at=default#cl-149
Title: Re: Black background when rotate an image
Post by: dec on 15 February 2013, 17:46:35
Hello,

Thank you for your answer Galfar. I'll take a look at your refered code. Thank you again.