473,395 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Convert 16bit Tiff to 1 bit tiff

I need help converting a PixelFormat.Format16bppRgb555 image to a PixelFormat.Format1bppIndexed image in VB.net

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
  1. Dim NewBmp As New Bitmap(imgW, imgH, Imaging.PixelFormat.Format16bppRgb555)
  2.             NewBmp.SetResolution(iWres, iHres)
  3.             Dim g As Graphics = Graphics.FromImage(NewBmp)
  4.  
  5.              '// Draw text string and extracted image to this image
  6.             g.FillRectangle(Brushes.White, New Rectangle(0, 0, imgW, imgH))
  7.             g.DrawString(ImageLabel, imgFont, Brushes.Black, 0.05 * iWres, 0)
  8.             g.DrawImage(ExtractedImage, New Rectangle(0, 0.5 * iHres,  iHW_New.X, iHW_New.Y)) 'draw to the new image
  9. NewBmp.Save("C:\images\" & ImageLabel & ".tif", ImageFormat.Tiff)
  10.  
Steve T.

VB.Net
Studio 2005
May 11 '07 #1
0 2249

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Dominic | last post by:
Hi guys, In .NET, how can I convert a HTML file to TIFF efficiently? One possible way is that I can first use word automatation to load the HTML up and then print it to TIFF. Is that right?...
0
by: Nicolas Guilhot | last post by:
Hi all ! I have a multi-page Tiff image file that I want to convert to PDF. To do so I am using iText library. The conversion is working, but the code execution is very different according to...
0
by: Greg | last post by:
Hello, I'm trying to load a 16bit multiframe TIFF-file in a bitmap, but it doesn't work. Error message: 'System.Runtime.InteropServices.ExternalException' 'A generic error occurred in GDI+' ...
4
by: Pushp | last post by:
Hello friends, Can any body tell me the sample code to convert a Tiff image to a Gif or Jpeg format. The Resolution of picture is a big concern keeping in mind. Hope to get the response...
1
by: Daniel | last post by:
I have looked everywhere on the web for an answer to this and the only thing I can find is converting the image format when the file is present on the local filesystem. What I want to do is use a...
3
by: David A. Osborn | last post by:
I currently have a class that has an enumeration of graphics extensions that it supports ie: Public Enum GraphicFormats JPG JPEG BMP TIFF End Enum
0
by: Ayman | last post by:
Hi All, I develop an application to send fax using Dialogic card. I have to convert any file need to be sent to tiff file. I can convert any image file to tiff, but I would like to know how to...
0
by: gcorgnet | last post by:
Hi all, I have a set of Multipage Tiff documents that are to be sent to a web browser. So, I want to convert them to Gif (or Png) before sending them to the client. Those Tiff docs are bitonal...
0
by: ashz | last post by:
Hi All, I want to convert any document to tiff file format. Is it possible using dot net. Actually i have a simple button in my form that open a OpenFileDialog control. Using this i get the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.