i am new to VC++,
i am doing a simple vc++ project in that i had a situation.
i have images in .jpeg,.bmp and .png.
i need to implement an algorithm for image compression.....
• Load image into 24-bit image buffer
• Locate top, left pixel
• Convert Red channel 8-bit value to 6-bit
o 6-bit = (8-bit_RedValue/255) * 63
o Round computed 6-bit value to nearest integer
o Multiply rounded value by 4 (left shift by 2 bits) to shift 6-bit value into upper 6 bits of a byte
o Store resulting 8-bit value into the Red channel of the final output file
• Repeat conversion for Green channel
• Repeat conversion for Blue channel
• Move to pixel located directly to the right. If at the end of the line, move to the left-most pixel of the next line. Repeat until all pixels have been processed
and my code is:
Bitmap^ img=gcnew Bitmap(b1->Size.Width,b1->Size.Height, PixelFormat::Format24bppRgb);
for (int i = 0; i < img->Width; i++)
for (int j = 0; j < img->Height; j++)
c = img->GetPixel(i, j);
double oldr = c.R;
double oldg = c.G;
double oldb = c.B;
here after saving the final image..... the final image is taking high memory to save ...
like original image =10kb
please help me doing this........