Jump to content

Targa File: 'unknown TGA image type'


Recommended Posts

I received the following exception opening a target file I created...
 

System.FormatException: unknown TGA image type
 
   at PaintDotNet.Data.TgaFileType.OnLoad(Stream input) in d:\src\pdn\paintdotnet\src\PaintDotNet\Data\TgaFileType.cs:line 367
 
   at PaintDotNet.FileType.Load(Stream input) in d:\src\pdn\paintdotnet\src\Data\FileType.cs:line 496
 
   at PaintDotNet.Functional.Func.Eval[T1,TRet](Func`2 f, T1 arg1) in d:\src\pdn\paintdotnet\src\Base\Functional\Func.cs:line 158

 

 

I created it with my program, and I'm attempting to determine why the out tga file isn't loading properly in Paint.Net.

My program uses the TargaImage class from the following codeproject article: http://www.codeproject.com/Articles/31702/NET-Targa-Image-Reader

 

It supposedly follows adhers to Truevision TGA Specification 2.0

After reviewing my own code that generates the targa file... I looked up '\src\pdn\paintdotnet\src\PaintDotNet\Data\TgaFileType.cs' and found this reference source file: https://code.google.com/p/openpdn/source/browse/src/Data/TgaFileType.cs but there is a discrepancy in the line number. 

I'm attaching a sample tga file. The issue seems to be with the imageType, but my code specifies it to be '2' in value. What does it look like under debug?

Note that my code is uses TargaImage1.0 class (surprised that he updated his class recently, actually), and ultimately I wonder if bitmap image.... hmm


Opps.. nevermind, just realized the issue is indeed with my code.. TargaImage.Image is a bitmap image, and thus.. that's what I'm saving with a tga extension.. ....... Thanks Windows Fax viewer for the false positive :P

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...