Click here to Skip to main content
15,881,852 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to debug a DLL () running on the remote server using Visual studio 2005 Pin
ptr_Electron11-Jun-09 22:35
ptr_Electron11-Jun-09 22:35 
GeneralRe: How to debug a DLL () running on the remote server using Visual studio 2005 Pin
chirag_chauhan11-Jun-09 23:14
chirag_chauhan11-Jun-09 23:14 
QuestionQuitting an application Pin
Gagnon Claude11-Jun-09 2:18
Gagnon Claude11-Jun-09 2:18 
AnswerRe: Quitting an application Pin
Rajesh R Subramanian11-Jun-09 2:54
professionalRajesh R Subramanian11-Jun-09 2:54 
GeneralRe: Quitting an application Pin
chirag_chauhan11-Jun-09 19:27
chirag_chauhan11-Jun-09 19:27 
GeneralRe: Quitting an application Pin
Rajesh R Subramanian11-Jun-09 21:32
professionalRajesh R Subramanian11-Jun-09 21:32 
GeneralRe: Quitting an application Pin
chirag_chauhan11-Jun-09 23:20
chirag_chauhan11-Jun-09 23:20 
Questionsave bmp in grayscale formt Pin
Member 604218211-Jun-09 2:07
Member 604218211-Jun-09 2:07 
Hi,
I want to convert a 24 bpp image into 8 bit GRAYSCALE image. I have attached the following code snippet to do this .It is not working.

BITMAPINFOHEADER bmpInfoHeader;
BITMAPFILEHEADER bmpFileHeader;
unsigned int extrabytes, bytesize;
RGBQUAD palette[256];
unsigned int numPaletteEntries = 256;



// Fill the bitmap file header structure
bmpFileHeader.bfType = 'MB'; // Bitmap header
bmpFileHeader.bfSize = 0; // This can be 0 for BI_RGB bitmaps
bmpFileHeader.bfReserved1 = 0;
bmpFileHeader.bfReserved2 = 0;
bmpFileHeader.bfOffBits = 0;//sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * numPaletteEntries;



extrabytes = (4 - 320 % 4) % 4;


// This is the size of the padded bitmap
bytesize = (320 + extrabytes) * 435;

// Fill the bitmap info structure
bmpInfoHeader.biSize = sizeof(BITMAPINFOHEADER);
bmpInfoHeader.biWidth = 320;
bmpInfoHeader.biHeight = 435;
bmpInfoHeader.biPlanes = 1;
bmpInfoHeader.biBitCount = 8; // 8 - bit bitmap
bmpInfoHeader.biCompression = BI_RGB;
bmpInfoHeader.biSizeImage = bytesize; // includes padding for 4 byte alignment
bmpInfoHeader.biXPelsPerMeter = 0;
bmpInfoHeader.biYPelsPerMeter = 0;
bmpInfoHeader.biClrUsed = numPaletteEntries;
bmpInfoHeader.biClrImportant = 0;

ByteArray = new BYTE[bmpInfoHeader.biSizeImage];

while(j < bmpInfoHeader.biSizeImage)
{
if(j < bmpInfoHeader.biSizeImage/2)
ByteArray[j] = 255;
else
ByteArray[j] = 0;



j++;
}


//Write the bitmap file header
UINT nWrittenFileHeaderSize = fwrite(&bmpFileHeader, 1,
sizeof(BITMAPFILEHEADER), pFile);
//And then the bitmap info header
UINT nWrittenInfoHeaderSize = fwrite(&bmpInfoHeader,
1, sizeof(BITMAPINFOHEADER), pFile);
//Finally, write the image data itself
fwrite(ByteArray, 1, bmpInfoHeader.biSizeImage, pFile);

Can u pls. help.
QuestionRe: save bmp in grayscale formt Pin
CPallini11-Jun-09 3:27
mveCPallini11-Jun-09 3:27 
AnswerRe: save bmp in grayscale formt Pin
Member 604218217-Jun-09 23:24
Member 604218217-Jun-09 23:24 
AnswerRe: save bmp in grayscale formt Pin
Chris Losinger11-Jun-09 4:00
professionalChris Losinger11-Jun-09 4:00 
Questionmodule name Pin
ali kanju11-Jun-09 1:17
ali kanju11-Jun-09 1:17 
AnswerRe: module name Pin
Rajesh R Subramanian11-Jun-09 1:39
professionalRajesh R Subramanian11-Jun-09 1:39 
GeneralRe: module name Pin
Hamid_RT11-Jun-09 1:42
Hamid_RT11-Jun-09 1:42 
JokeThe monkeys do it! Pin
Rajesh R Subramanian11-Jun-09 2:12
professionalRajesh R Subramanian11-Jun-09 2:12 
GeneralRe: module name Pin
ali kanju11-Jun-09 1:45
ali kanju11-Jun-09 1:45 
AnswerRe: module name Pin
Hamid_RT11-Jun-09 1:40
Hamid_RT11-Jun-09 1:40 
AnswerRe: module name Pin
CPallini11-Jun-09 1:41
mveCPallini11-Jun-09 1:41 
GeneralRe: module name Pin
ali kanju11-Jun-09 1:52
ali kanju11-Jun-09 1:52 
GeneralRe: module name Pin
CPallini11-Jun-09 2:04
mveCPallini11-Jun-09 2:04 
GeneralRe: module name Pin
ali kanju11-Jun-09 2:12
ali kanju11-Jun-09 2:12 
QuestionEvent sink for event raised by managed code component. Pin
Keith Sheppard11-Jun-09 0:51
Keith Sheppard11-Jun-09 0:51 
AnswerRe: Event sink for event raised by managed code component. Pin
Keith Sheppard11-Jun-09 1:57
Keith Sheppard11-Jun-09 1:57 
QuestionHIde a Process in Task manager Pin
tns_ranjith11-Jun-09 0:19
tns_ranjith11-Jun-09 0:19 
AnswerRe: HIde a Process in Task manager PinPopular
Rajesh R Subramanian11-Jun-09 0:21
professionalRajesh R Subramanian11-Jun-09 0:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.