Groups | Blog | Home
all groups > dotnet drawing api > march 2007 >

dotnet drawing api : Tif file parameters question


Robert Dufour
3/18/2007 4:14:52 PM
I create a 32bpp rgb bitmap in my code to write some text to it then convert
it to a monochrome. My original bitmap is 1728 W by 2261 High with a
resolution set of X= 204 and Y = 196.
After converting it to a monochrome bitmap it has the same pixels height
width and resolutions.
I then save it as a tif file with cdcit group 3 fax compression. But it
won't fax out with my dialogic board.
I know the tiff file should be 1728 wide, single striped segmentation,
multipage tiff even though it only contains one page. The code that does my
conversion to tif is the following.

MyBitMapBW = BmpCvrtr.ConvertBmp32rgbToBitonal(MyBitmapRgb)

'I finish the conversion to B&W then
Dim MyEncoder As Encoder

Dim MyEncoderParam As EncoderParameter

Dim MyEncoderParams As EncoderParameters = New EncoderParameters(5)

MyEncoderParams.Param(0) = New EncoderParameter(Encoder.Compression,
CType(EncoderValue.CompressionCCITT3, Long))

MyEncoderParams.Param(1) = New EncoderParameter(Encoder.ColorDepth, 1) '

MyEncoderParams.Param(2) = New EncoderParameter(Encoder.SaveFlag,
CType(EncoderValue.MultiFrame, Long)) '

MyEncoderParams.Param(3) = New EncoderParameter(Encoder.SaveFlag,
CType(EncoderValue.FrameDimensionPage, Long)) '

MyEncoderParams.Param(4) = New EncoderParameter(Encoder.SaveFlag,
CType(EncoderValue.Flush, Long)) '

Dim MyImgCodecInfo As ImageCodecInfo = GetEncoderInfo("image/tiff")

MyBitMapBW.Save("C:\TIFF\TestFax.Tif", MyImgCodecInfo, MyEncoderParams)



What am I dong wrong? Can anyone put me on the track to converting this
correctly.

Thanks for any help.

Bob

Michael C
3/19/2007 12:00:00 AM
[quoted text, click to view]

You need to convert to 1 to long here also as it will default to int.

Michael

Michael C
3/19/2007 12:00:00 AM
[quoted text, click to view]

If that wasn't the problem try having a look at 2 tiff files in a hex
editor. The format isn't that complex to understand. You can download tiff
file info from the web. You might end up having to write the file to disk
manually if there's one small param that your fax proggy doesn't like.

Michael

Robert Dufour
3/19/2007 11:14:30 AM
Thanks Michael, you've been GREAT
Bob
[quoted text, click to view]

AddThis Social Bookmark Button