Question

I use freeimage.net in my web project. I rotate a picture(.jpg) with RotateClassic function,but after that the background is black. How to make it transparent? thanks for any help.

Was it helpful?

Solution 2

JPG's files do not support transparency as gif or png. I think you want to set a different background color as white (or any other color) right? Well, freeimage does not support this option and after play ( a lot ) with the code I found a workaround to change the backcolor to white:

ClassicRotate.cpp

Methods: HorizontalSkew and VerticalSkew

1) Change the second parameter (0) in memset to 1 or the color you want, but only in the lines that have comments related with background (two changes by method)

Example: memset(dst_bits, 0, iOffset * bytespp); memset(dst_bits, 1, iOffset * bytespp);

2) Replace memcpy with memset (1 change by method)

Example memcpy(dst_bits, &pxlOldLeft[0], bytespp); memset(dst_bits, 1, bytespp);

In my case I use 1 to represent white (GIF, 8BPP)

Regards

OTHER TIPS

You need to check out the CSS opacity property.

http://webdesign.about.com/od/css3/a/aa121306.htm

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top