Solved

C# system.drawing.image.save .tiff actually .png (or at least photoshop CS3 thinks so)

Posted on 2009-05-15
6
2,721 Views
Last Modified: 2013-12-17
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?
0
Comment
Question by:BSL43
  • 4
  • 2
6 Comments
 
LVL 39

Expert Comment

by:abel
ID: 24397012
Photoshop is correct. MsPaint is lenient and checks the header info of the image, which is probably a BMP or WMF if you do not specify a format.

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
0
 
LVL 39

Expert Comment

by:abel
ID: 24397085
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
0
 

Author Comment

by:BSL43
ID: 24397112
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.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 39

Accepted Solution

by:
abel earned 250 total points
ID: 24397424
> but they why does Tiff show up in your screen shot of available file types above....

haha, indeed, you are right. I must be blind, and very stupid (today only, lol). I looked at it a couple of times, but now: it is there. However, I use VS 2008, I'll have to check this for 2005. Can you show me the code of how you save the file? And maybe you can add a little resultant *.tiff file here (rename it to .txt, otherwise the "attached file" doesn't cooperate).
0
 

Author Comment

by:BSL43
ID: 24398011
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.  
0
 
LVL 39

Expert Comment

by:abel
ID: 24398133
ah, good to know. So, this means: if you do not specify the format, the format is PNG.

glad it works now :)
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
In this tutorial viewers will learn how to restore old photos in Photoshop (an introduction to the Clone tool) Zoom into a damaged area: Click on the "Stamp" icon to use the Clone tool. Hold the Alt key and click to select a region. Click again, and…
In this tutorial viewers will learn a few layer organization tricks and tips to improve their workflow in Photoshop. Open a multi-layer document in Photoshop: View all your layers by going Window > Layers:  To make sure your layers can be identified…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now