Connecting Tech Pros Worldwide Forums | Help | Site Map

Tiff images

Sameer Gupta
Guest
 
Posts: n/a
#1: Sep 18 '06
what are options for opening / handling tiff files in .Net framework ?
which is the best library, namespace ?

Please help

Regards
Sameer Gupta
C# Designer & Developer
Siemens
UK

Michael Nemtsev
Guest
 
Posts: n/a
#2: Sep 18 '06

re: Tiff images


Hello Sameer,

GDI+ saves u.
Look MSDN for this.

SSwhat are options for opening / handling tiff files in .Net framework
SS? which is the best library, namespace ?
SS>
SSPlease help
SS>
SSRegards
SSSameer Gupta
SSC# Designer & Developer
SSSiemens
SSUK
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche


Sameer Gupta
Guest
 
Posts: n/a
#3: Sep 18 '06

re: Tiff images


Thanks Michael.

GDI+ looks quite generic.

which is better for Tiff images - GDI+ or VintaSoft.Tiff (@
http://www.vintasoft.com/vstiff-dotnet-faq.html) ?

in terms of features & performance?

Please suggest.

Regards
Sameer Gupta
C# Designer & Developer
Siemens
UK

"Michael Nemtsev" wrote:
Quote:
Hello Sameer,
>
GDI+ saves u.
Look MSDN for this.
>
SSwhat are options for opening / handling tiff files in .Net framework
SS? which is the best library, namespace ?
SS>
SSPlease help
SS>
SSRegards
SSSameer Gupta
SSC# Designer & Developer
SSSiemens
SSUK
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour
>
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
>
>
>
Bruce Wood
Guest
 
Posts: n/a
#4: Sep 18 '06

re: Tiff images



Sameer Gupta wrote:
Quote:
what are options for opening / handling tiff files in .Net framework ?
which is the best library, namespace ?
Well, what is "best" depends very much on what you want to do, and how
much control you want.

If you just want to display images, the Image / Bitmap classes are
probably the ones you want. Be forewarned, though, that
Image.FromFile() leaves the TIF file locked for a while... probably
until the garbage collector gets around to doing something with the
objects that FromFile was using to read the file.

I read the TIF file into a MemoryStream and then feed it to
Image.FromStream(), like this:

Image fullImage;
System.IO.Stream st = System.IO.File.Open(imageFilePath,
System.IO.FileMode.Open, System.IO.FileAccess.Read,
System.IO.FileShare.Read);
try
{
byte[] b = new byte[st.Length];
st.Read(b, 0, b.Length);
System.IO.MemoryStream ms = new System.IO.MemoryStream(b);
fullImage = Image.FromStream(ms);
}
finally
{
st.Close();
}

which ensures that the file lock is released as soon as possible.

Be also forewarned that the Image class limits your control over the
image format. There are a limited set of bit depths at your disposal,
for example, which can cause a lot of bloat in memory as tiny
black-and-white TIF images are blown out into (unnecessary) 8-bit or
16-bit colour in memory.

Nonetheless, if all you want to do is show pictures to your user, this
is no doubt the simplest way to do that.

Sameer Gupta
Guest
 
Posts: n/a
#5: Sep 18 '06

re: Tiff images


Thanks very much Bruce.

Actually I have lot of Tiff files, many of them are corrupted.
I need to programmatically validate / check the existing tiff files whether
they are corrupt or not. a read only mode. also don't wanna lock files.

GDI + is an option. also there is VintaSoft.Tiff library for .Net.

Please help in finding an appropriate way.


Regards
Sameer Gupta
C# Designer & Developer
Siemens
UK


"Bruce Wood" wrote:
Quote:
>
Sameer Gupta wrote:
Quote:
what are options for opening / handling tiff files in .Net framework ?
which is the best library, namespace ?
>
Well, what is "best" depends very much on what you want to do, and how
much control you want.
>
If you just want to display images, the Image / Bitmap classes are
probably the ones you want. Be forewarned, though, that
Image.FromFile() leaves the TIF file locked for a while... probably
until the garbage collector gets around to doing something with the
objects that FromFile was using to read the file.
>
I read the TIF file into a MemoryStream and then feed it to
Image.FromStream(), like this:
>
Image fullImage;
System.IO.Stream st = System.IO.File.Open(imageFilePath,
System.IO.FileMode.Open, System.IO.FileAccess.Read,
System.IO.FileShare.Read);
try
{
byte[] b = new byte[st.Length];
st.Read(b, 0, b.Length);
System.IO.MemoryStream ms = new System.IO.MemoryStream(b);
fullImage = Image.FromStream(ms);
}
finally
{
st.Close();
}
>
which ensures that the file lock is released as soon as possible.
>
Be also forewarned that the Image class limits your control over the
image format. There are a limited set of bit depths at your disposal,
for example, which can cause a lot of bloat in memory as tiny
black-and-white TIF images are blown out into (unnecessary) 8-bit or
16-bit colour in memory.
>
Nonetheless, if all you want to do is show pictures to your user, this
is no doubt the simplest way to do that.
>
>
Kevin Spencer
Guest
 
Posts: n/a
#6: Sep 18 '06

re: Tiff images


Actually, "GDI+" is just a generic term for the graphics namespaces in .Net.
You would have to (as I did) create your own class(es) to parse the TIFF
file if you want to get at the tags in it, multiple images, etc. So, unless
you want to do that, a commercial .Net TIFF library is your best bet.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

What You Seek Is What You Get.

"Sameer Gupta" <SameerGupta@discussions.microsoft.comwrote in message
news:364CEADA-4DF6-4645-97C3-9950399A22FC@microsoft.com...
Quote:
Thanks very much Bruce.
>
Actually I have lot of Tiff files, many of them are corrupted.
I need to programmatically validate / check the existing tiff files
whether
they are corrupt or not. a read only mode. also don't wanna lock files.
>
GDI + is an option. also there is VintaSoft.Tiff library for .Net.
>
Please help in finding an appropriate way.
>
>
Regards
Sameer Gupta
C# Designer & Developer
Siemens
UK
>
>
"Bruce Wood" wrote:
>
Quote:
>>
>Sameer Gupta wrote:
Quote:
what are options for opening / handling tiff files in .Net framework ?
which is the best library, namespace ?
>>
>Well, what is "best" depends very much on what you want to do, and how
>much control you want.
>>
>If you just want to display images, the Image / Bitmap classes are
>probably the ones you want. Be forewarned, though, that
>Image.FromFile() leaves the TIF file locked for a while... probably
>until the garbage collector gets around to doing something with the
>objects that FromFile was using to read the file.
>>
>I read the TIF file into a MemoryStream and then feed it to
>Image.FromStream(), like this:
>>
>Image fullImage;
>System.IO.Stream st = System.IO.File.Open(imageFilePath,
>System.IO.FileMode.Open, System.IO.FileAccess.Read,
>System.IO.FileShare.Read);
>try
>{
>byte[] b = new byte[st.Length];
>st.Read(b, 0, b.Length);
>System.IO.MemoryStream ms = new System.IO.MemoryStream(b);
>fullImage = Image.FromStream(ms);
>}
>finally
>{
>st.Close();
>}
>>
>which ensures that the file lock is released as soon as possible.
>>
>Be also forewarned that the Image class limits your control over the
>image format. There are a limited set of bit depths at your disposal,
>for example, which can cause a lot of bloat in memory as tiny
>black-and-white TIF images are blown out into (unnecessary) 8-bit or
>16-bit colour in memory.
>>
>Nonetheless, if all you want to do is show pictures to your user, this
>is no doubt the simplest way to do that.
>>
>>

Closed Thread