Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Ladies and Gentlemen,

 

I am presently developing an application that will watermark .TIFF images we have on our system. These images are strictly black-and-white, so they are stored in 1 bit-per-pixel indexed format (Imaging.PixelFormat.Format1bppindexed) which naturally leads to them being very compressed.

 

Now, I know that you cannot assign a Graphics object to an indexed-pixel image, so I create a mediary bitmap in Imaging.PixelFormat.Format24bppRGB and use the first bitmap as a source to draw into the second one, to wit:

 

' Read source TIFF into new bitmap object

Dim m_clsSource As New Bitmap(strPath)

 

' Create destination bitmap object with the same features

Dim m_clsDest As New Bitmap(m_clsSource.Width, m_clsSource.Height, Imaging.PixelFormat.Format24bppRgb)

m_clsDest.SetResolution(m_clsSource.HorizontalResolution, m_clsSource.VerticalResolution)

 

Dim m_clsFrame As Bitmap

Dim m_clsCanvas As Graphics = Graphics.FromImage(m_clsDest)

 

Dim X, intPageCount As Integer

intPageCount = m_clsSource.GetFrameCount(Imaging.FrameDimension.Page)

 

m_clsCanvas.DrawImage(m_clsSource, 0, 0, m_clsDest.Width, m_clsDest.Height)

 

My question is, now - how do I go about converting m_clsDest back into the 1 bit-per-pixel indexed format?

 

Or, is there a graphics tool/class available on the net that would enable me to directly manipulate the graphic in its native 1bpp mode? Note that my employer's security policy would dictate that I need the source code for such a class and compile it personally.

 

Thank you for your time,

Charles Mousseau.

 

***

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...