Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

Wanna-Be C# Superstar
Posted

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?

Wanna-Be C# Superstar
  • *Experts*
Posted

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

"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
  • 2 weeks later...
Posted

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.

Wanna-Be C# Superstar

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...