The images I'm working with are all black and white documents. I create the original 16 bit image. Then I create a graphics handle to it so I can use it for drawing. I want the final output file to be just a 1 bit (2 color) tiff file because of the much smaller file size. Too bad VB.net doesn't let you create a Graphics handle to 1bppIndexed images.
I tried using BitBlt and Stretchblt to copy from the 16 bit image to a 1 bit image but that I haven't been able to make that work. I'm to open to suggestions.
Any help would be appreciated.
Here is the code I wrote that creates a new image, draw some stuff to it and saves it to a file. The output is about 860K at 200 DPI. I would like to get below 100K and preferably below 50K for a single frame Tiff file.
Expand|Select|Wrap|Line Numbers
- Dim NewBmp As New Bitmap(imgW, imgH, Imaging.PixelFormat.Format16bppRgb555)
- NewBmp.SetResolution(iWres, iHres)
- Dim g As Graphics = Graphics.FromImage(NewBmp)
- '// Draw text string and extracted image to this image
- g.FillRectangle(Brushes.White, New Rectangle(0, 0, imgW, imgH))
- g.DrawString(ImageLabel, imgFont, Brushes.Black, 0.05 * iWres, 0)
- g.DrawImage(ExtractedImage, New Rectangle(0, 0.5 * iHres, iHW_New.X, iHW_New.Y)) 'draw to the new image
- NewBmp.Save("C:\images\" & ImageLabel & ".tif", ImageFormat.Tiff)
VB.Net
Studio 2005