Hi Guys, i want to open .tiff and .tga images in my program's PictureBox but i am not able to open them, any Solution??

You've encountered one of the most irritating things about .NET (at least for me): image processing is quite wanting. I don't work with TGA much, but I work extensively with TIFF. The .NET imaging libraries either do not support TIFF readily, such as PictureBox, or the support for conversion of certain types to BMP such that PictureBox would accept it is lacking. A good example is JPEG compressed TIFF. Neither the old style .NET imaging classes nor the much superior WPF imaging classes (which can be used in WinForms) support that compression method.

Long story short, you have two options:

  1. Use a more robust imaging library such as Magick.NET to convert your TIFF and TGA images to BMP so that you can use a PictureBox directly.

  2. Find a third party image viewer control that will support the image types you need.

Either way you'll find yourself using a third party library for the heavy lifting.

Hmm..i dont wanna use Third Party Image viewer control, any code to open the file? Please help me...

i dont wanna use Third Party Image viewer control

Then your two options have become one option. You'll need to use a third party library to convert the image to a format PictureBox likes. I say a third party library because .NET's built in imaging libraries may likely still cause you problems due to lack of support for the source image type.

Ok, Thanks

The following article shows how to save, split, merge, and view multipage TIFF image using .NET Framework classes.
http://www.c-sharpcorner.com/blogs/how-to-save-split-merge-and-view-multipage-tiff-image1

However, as deceptikon mentioned in his reply, some types (compressions) of TIFF format are not natively supported under .NET framework. So you need to use a programming SDK (leadtools) to load such images in code and convert them to compatible GDI+ image object to load it in picture box

Thanks for the replies guys, I got that working

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.