RE: tiff compression - again -
10-07-2004
, 02:59 PM
You should be able to adapt this code to C3 if needed realy easy I got it
from C# og.
This was written to save it as a 1bpp file but I took out that code you can
change the formate to LZW.
Also the default save for a bitmap to tiff is LZW so if you load your tif to
a 32RGB bitmap and save it it should be LZW
Dim info As ImageCodecInfo = Nothing
Dim ice As ImageCodecInfo
For Each ice In ImageCodecInfo.GetImageEncoders()
If ice.MimeType = "image/tiff" Then
info = ice
End If
Next ice 'use the save encoder
Dim ep As New EncoderParameters(1)
ep.Param(0) = New EncoderParameter(Encoder.Compression,
CLng(EncoderValue.CompressionCCITT3))
Dim myBitmap As New Bitmap(612, 792, PixelFormat.Format1bppIndexed)
Dim myEncoderParameters As New EncoderParameters(2)
myEncoderParameters.Param(0) = New EncoderParameter(Encoder.ColorDepth,
CLng(1))
myEncoderParameters.Param(1) = New EncoderParameter(Encoder.Compression,
CLng(EncoderValue.CompressionCCITT4))
myBitmap = clipboardData.GetData(System.Windows.Forms.DataFor mats.Bitmap)
myBitmap.Save(Application.StartupPath & "\" & iPCR.ToString & p & ".tif",
info, myEncoderParameters)
myBitmap = Nothing |