0
Answer

Trouble saving tiffs

Ask a question

I am having a rough time with tiffs. When I save certain tiff files (those from a camera or scanner) they are partially corrupted.

If I open the file in Photoshop I get a message "This document may be damaged (the file may be truncated or incomplete). Continue?". Another application, ExifRead, shows that there is significantly less EXIF data, or for some images it hangs while trying to open the file.

I was originally trying to alter the image (set resolution, flip, rotate) but the problem occurs with code as simple as: 

Bitmap myImage = Bitmap.FromFile("c:\mytiff.tif") as Bitmap;
myImage.Save("c:\temptiff.tif", ImageFormat.Tiff);

I've tried setting encoder and encoding parameters, I've tried reading from and writing to streams, I've tried manually reading the parameters (i.e. exif data) from a different copy of the source and writing it to the image, all with no luck.

Does anyone have any ideas as to how to get tiff images to always save correctly? 

Thanks,
-Mont