VBAHole22 Posted July 13, 2004 Posted July 13, 2004 I have a simple routine that converts gif images to tiffs like so If fi.Name.Substring(fi.Name.Length - 4, 4).ToUpper = ".GIF" Then Dim img As Image = Image.FromFile(fi.FullName) Dim tifName As String tifName = Path.GetDirectoryName(fi.FullName) tifName = tifName & "\" & Path.GetFileNameWithoutExtension(fi.Name) & ".tif" img.Save(tifName, ImageFormat.Tiff) i += 1 Me.txtResults.Text = Me.txtResults.Text & System.Environment.NewLine & i & " Saved " & tifName Else MessageBox.Show("Something is messed up this is not a gif file") End If Really very simple. But is there a way that I can control the compression of the tiff that results? I have tried looking into the EncoderParameters but there is scare info out there about this stuff. Any suggestions? Quote Wanna-Be C# Superstar
Folle_Invasato Posted July 13, 2004 Posted July 13, 2004 try to give a look at: http://www.bobpowell.net Quote
VBAHole22 Posted July 13, 2004 Author Posted July 13, 2004 Yeah, I have come across that site during my searches. He does have a routine for JPEG compression but not gif or tiff. He uses the EncoderParameters and literal strings like codec.MimeType=="image/jpeg") I'm wondering where this stuff is cataloged? How does one find out about the collections and how to use them? Quote Wanna-Be C# Superstar
Folle_Invasato Posted July 14, 2004 Posted July 14, 2004 You can find a list of MIME types in your Windows registry, under the key HKEY_CLASSES_ROOT\MIME\Database\Content Type Quote
*Experts* Nerseus Posted July 14, 2004 *Experts* Posted July 14, 2004 Doing a search on "tiff compression EncoderParameter" in Google turned up a number of good hits. No direct sample code to do exactly what you want, but very close (including getting the parameters needed for each mime type when using the EncoderParameter object). -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
VBAHole22 Posted July 27, 2004 Author Posted July 27, 2004 Okay, I made small progress on this one. I managed to get the encoder parameters working for LZW and No Compression but there are other options (CCIT3, CCIT4, RLE). None of these options will work for me. They all throw errors. What's up with that? I would like to use RLE but can't figure out how. I am also interested in doing gif to tif with no compression but I want to reduce the colors from 256 to 16. Anyone know how to do that? I gotta say, working with images like this in .NET is not fun or easy. Why is it so complicated and how come there is so little code out there? Is everyone just using photoshop or some 3rd party tool? Can you program those to run batch? Any suggestions will be greatly appreciated. Quote Wanna-Be C# Superstar
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.