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
Solved

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

Posted on 2009-05-15
6
2,734 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Do I have my bleeds and trim dimensions correct? 7 21
RegEx with optional part 4 42
Easy filter aspnet 2 24
PowerShell:  Column widths won't expand 3 17
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to correct colors in Photoshop using the Color Balance adjustment Open a photo for editing in Photoshop: Open a photo for editing in Photoshop: Select "OK" on the dialogue: The Color Balance adjustment works b…
In this tutorial viewers will learn how to increase their history states in Photoshop To undo more than one history state, use Ctrl + Alt + Z, not just Ctrl + Z: View the History window by going to Window > History: The default number of history sta…

856 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