BSL43
asked on
C# system.drawing.image.save .tiff actually .png (or at least photoshop CS3 thinks so)
I am saving an image from a C# program developed in Visual Studio 2005 .NET using the system.drawing.image.save to save it as a .tiff file. I can open it in MS Paint, and any other program I've tried EXCEPT for photoshop (cs3 and cs4) - photoshop says its an invalid file format. If I rename it from image.tiff to image.png then photoshop opens it. If I open the image.tiff in paint and resave it as a .tiff, then photoshop also opens it. It would seem as if VS2K5 is saving the image as a .png even though I specify the format as .tiff. Has anyone seen this behavior before or have any ideas?
However, using ImageCodecs, which are installed on any windows system, it is possible with a workaround. Here's one way for multipage tiffs (sorry, it is reading, not writing): http://www.bobpowell.net/addframes.htm
and here is a way for splitting a tiff image: http://www.codeproject.com/KB/GDI-plus/tiffmanager.aspx
and finally, the one and only class for tiff manipulation: http://kseesharp.blogspot.com/2007/12/class-for-tiff-manipulation.html
and here is a way for splitting a tiff image: http://www.codeproject.com/KB/GDI-plus/tiffmanager.aspx
and finally, the one and only class for tiff manipulation: http://kseesharp.blogspot.com/2007/12/class-for-tiff-manipulation.html
ASKER
I understand what you are saying (I think), but they why does Tiff show up in your screen shot of available file types above.... Also, what 3rd party library would you recommend then for VS2K5 .Net c# development? Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Okay, so you got me thinking. Sure enough in several locations I didn't specify the imageformat .tiff along with the save so even though I had the correct save, vs was defaulting it to a png compression with a .tiff extension. Thanks.
ah, good to know. So, this means: if you do not specify the format, the format is PNG.
glad it works now :)
glad it works now :)
It is not possible to store an image as a TIFF file, at least not with .NET without having third party libraries to help you. In the screenshot is the list of available image types.
ScreenShot282.png