Hello, I am new to EasyBMP. I modified some example code, and I expected it to take an input image, and copy it into a new image, but for the new image to be slightly transparent. The problem is that it seems to ignore the transparency (which I set by giving all the pixels an "alpha" of 100). There must be something really basic that I am doing wrong. Here is my code:
#include "EasyBMP.h"
using namespace std;
int main( int argc, char* argv[] )
{
BMP Input;
Input.ReadFromFile("/Users/ahmiljilani/Desktop/AmbrinaRose Website/flowerletter i 1.bmp");
int width = Input.TellWidth();
int height = Input.TellHeight();
BMP Output;
Output.SetSize(width,height);
Output.SetBitDepth(32);
for( int j=0 ; j < height ; j++ )
{
for( int i=0; i < width ; i++ )
{
int r = Input(i,j)->Red;
int g = Input(i,j)->Green;
int b = Input(i,j)->Blue;
int a = Input(i,j)->Alpha;
Output(i,j)->Red = r;
Output(i,j)->Green = g;
Output(i,j)->Blue = b;
Output(i,j)->Alpha = 100;
/* int r2 = Output(i,j)->Red;
int g2 = Output(i,j)->Green;
int b2 = Output(i,j)->Blue;
int a2 = Output(i,j)->Alpha;
if (r!=255 or g!=255 or b!=255 or a!=0)
{
cout << "pixel (" << i << "," << j << "): " << r << "," << g << "," << b << "," << a << "\n";
cout << "pixel (" << i << "," << j << "): " << r2 << "," << g2 << "," << b2 << "," << a2 << "\n";
}*/
}
}
Output.WriteToFile("/Users/ahmiljilani/Desktop/AmbrinaRose Website/out.bmp");
}
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
Okay it looks like it did actually add an alpha channel to the file, but programs like Apple's Safari and Preview ignore them. Photoshop also does not show those pixels as transparent, but it does include a "mask" with the alpha values.