Hello Experts,
I am trying to create an avi file for a given jpg images. I am reading jpg's using a library and preparing hbitmap for it. Finally i am adding it to create avi file. But my final avi file contains the inverted images. I kept nagative for hight in bitmapheader. Still my hbitmap is inverted. Can you please help why the error
Here i am giving the code which i implemented
void makeVideo()
{
GoldImage Test ;
for(int i=0;i<10;i++)
{
Test.SetImage(m_MyImage[i])
HBITMAP hBitmap;
Test.GetBitMap(0,0,hBitmap);
if(i==0)
{
avi = CreateAvi("test.avi",1000,NULL);
AVICOMPRESSOPTIONS opts; ZeroMemory(&opts,sizeof(opts));
SetAviVideoCompression(avi,hBitmap,&opts,true,NULL);
}
AddAviFrame(avi,hBitmap);
}
CloseAvi();
}
void GoldImage::GetBitMap(HBITMAP &hBitmap)
{
BITMAPINFOHEADER bmi;
bmi.biSize = sizeof(BITMAPINFOHEADER);
bmi.biWidth = Width
**bmi.biHeight = (-1)*Height;**
bmi.biPlanes = 1;
bmi.biBitCount = 32;
**bmi.biCompression = BI_RGB;**
bmi.biSizeImage = 0;
bmi.biXPelsPerMeter = 0;
bmi.biYPelsPerMeter = 0;
bmi.biClrUsed = 0;
bmi.biClrImportant = 0;
RGBQUAD *prgbaDIB = 0;
hBitmap = CreateDIBSection ( NULL, (BITMAPINFO *)&bmi, DIB_RGB_COLORS, (void**)&prgbaDIB, NULL, 0 );
const unsigned int columns = m_Image.columns();
const unsigned int rows = m_Image.rows();
RGBQUAD *pDestPixel = prgbaDIB;
for( unsigned int row = 0 ; row < rows ; row++ )
{
const PixelPacket *pPixels = m_Image.getConstPixels(0,row,columns,1);
for( unsigned long nPixelCount = columns; nPixelCount ; nPixelCount-- )
{
pDestPixel->rgbRed = ScaleQuantumToChar(pPixels->red);
pDestPixel->rgbGreen = ScaleQuantumToChar(pPixels->green);
pDestPixel->rgbBlue = ScaleQuantumToChar(pPixels->blue);
pDestPixel->rgbReserved = 0;
++pDestPixel;
++pPixels;
}
}
}
Thanks in Advance