?
Solved

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

Posted on 2009-05-15
6
Medium Priority
?
2,765 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 39

Accepted Solution

by:
abel earned 1000 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

TCP/IP Network Protocol Cheat Sheet

TCP/IP is a set of network protocols which is best known for connecting the machines that make up the Internet. The truth is that TCP/IP is one of the oldest network protocols and its survival is mainly based on its simplicity and universality.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll explain how to change the color of a selection in Photoshop. I'm sure there are a couple different ways to do this in photoshop, but this is my preferred method in Photoshop. I am using Photoshop CS6 and I will be adjusting the…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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 Micro Tutorial viewers will learn how to remove an unwanted object using Photoshop’s feature known as content-aware fill.
Suggested Courses
Course of the Month14 days, 9 hours left to enroll

771 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