HighTechTalks DotNet Forums  

tiff compression - again

Dotnet Framework (Drawing) microsoft.public.dotnet.framework.drawing


Discuss tiff compression - again in the Dotnet Framework (Drawing) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Al
 
Posts: n/a

Default tiff compression - again - 10-07-2004 , 05:49 AM






Since I have no takers on reviewing my existing code, I'll try asking a
simpler question....

If I have an existing multipage tiff file, how can I use VB.NET to resave it
using LZW
compression?

Thanks in advance for any responses.



Reply With Quote
  #2  
Old   
Joshua Schipper AKA speller
 
Posts: n/a

Default 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

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.