views:

258

answers:

4

In my application I am using Images, these images can be .tga(Targa Graphic) file as well, when I am creating instance of BitmapImage using .tga file, it throws exception saying "No imaging component suitable to complete this operation was found.".

Is there any other way to work with .tga file in wpf? How can I use these(.tga) files just like any other .jpg(Image file) in wpf?

A: 

TGA is not a very widespread format... The exception means exactly what it says : WPF doesn't have a suitable decoder for this format. You will have to convert it to a known format.

Thomas Levesque
How can I convert it programatically? Is there any converter available?
viky
Not in the .NET framework, but you can probably find one on the web...
Thomas Levesque
still looking for some help!!! Unable to find any such converter....
viky
It seems that ImageMagick supports the TGA format. http://www.imagemagick.org/script/formats.php
Thomas Levesque
didn't find way to use it, of course i am from .net background and don't understand C++
viky
There's a .NET wrapper here : http://imagemagick.codeplex.com/
Thomas Levesque
A: 

Can't vouch for the quality of this project, but you might look here: http://www.codeproject.com/KB/graphics/TargaImage.aspx

Here's the TGA specification if you want to roll your own: local.wasp.uwa.edu.au/~pbourke/dataformats/tga/

Scott J
A: 

google "FreeImage" it's a free open source library for images and it has a c# wrapper

momo