Tiff to JPEG

Z

ZUP_DUDE

Hi All,

I'm using the System.Drawing.Image name space to convert images from
one type to another. In this case I am trying to convert a Tiff to a
JPEG. The code is as simple as the next two lines...

System.Drawing.Image image = Image.FromFile( this.importFilePath );
image.Save( exportFilePath, System.Drawing.Imaging.ImageFormat.Jpeg );

The code almost always seems to work, but some times I receive the
following error...

System.ArgumentException: Invalid parameter used.
at System.Drawing.Image.Save(String filename, ImageCodecInfo
encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(String filename, ImageFormat format)

I am 100% sure that the file paths are correct. Has anyone dealt with
this error before?

Any suggestions would be great.

Thanks in advance
 
Z

ZUP_DUDE

Just a little extra info...

The Tiff is comming from Quark. That's probably the issue. I opened the
file in paint, saved it, and then was able to convert it. Has anyone
had problems converting Quark tiff's to Jpeg's using GDI+? If so, do
you have any better solutions than opening the file in paint and then
saving it again?
 
B

Bob Powell [MVP]

Tiff is such a wide spec that many decoders cannot handle all the options.
Do all of your images come from Quark or just this one that's having
problems?

Can you post a small example of a tiff produced by quark? no more than
128*128 if you can.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top