Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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,787 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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to correct colors in Photoshop using the Hue and Saturation adjustment Open a photo for editing in Photoshop: Begin by creating a new adjustment layer by going to Layer > New Adjustment Layer > Hue and Saturat…
Suggested Courses

604 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