Jump to content

3.5.5 odd TGA saving issue


MarkS
 Share

Recommended Posts

I have been using 3.5.4 on Windows 7, but have recently had to downgrade to XP (long story) and installed 3.5.5 on XP. I am using Paint.net for game art and noticed something very odd. Under Windows 7 and 3.5.4, I could save a TGA file and my TGA loader would open the file just fine. However, in 3.5.5, my loader loads the image vertically flipped. The solution is on my end; I was unaware of this option in the TGA specs and my loader wasn't accounting for it. What I am curious about is why Paint.net is NOW flipping the image when saving TGAs? This is an odd option in the TGA file spec and I am really baffled that any current app supports this option. Why save an image upside down? It may have made sense in 1984 when the specification was written (along with the BGR instead of RGB), but makes absolutely no sense now. Maybe people stood on their heads to view images in 1984? I didn't touch a computer until 1985 at age 8, so I really don't know...

This actually benefited me in the long run as I now will have a more robust file loader, but I still find this more than a little strange. I am assuming that there is a good reason for this, but cannot figure it out for the life of me. Any ideas?

Link to comment
Share on other sites

Just as a guess, I found a copy of 3.5.4 online and installed it. I get the same issue. I'm wondering if it is somehow related to XP? Maybe a .NET issue? All I know for certain is that the image was saved right side up in Windows 7 x64. Could it be a x64 vs. x32 issue? Very odd indeed.

Link to comment
Share on other sites

The TGA code isn't going to change on XP vs. 7, it is self-contained and not using any OS functionality. It's not a .NET issue, as the code is not using any of the framework functionality either. And it's certainly not a 32-bit vs. 64-bit issue*. Paint.NET has always saved the rows in "upside-down" order because that's how TGAs are conventionally saved, and many other apps just assume this without checking the image header flags. It's just like how BMPs are "upside-down" (even though, mathematically speaking, they are upside-up). The TGA loading code will correctly respect both X and Y mirror flags in the TGA image descriptor. "Y mirrored" in this case means that the image is saved top-down.

If you're still not convinced, use Reflector to go look at PaintDotNet.Data.dll, at the TgaFileType sitting in the PaintDotNet.Data namespace, at the SaveTga() method.

* btw there is no such thing as x32. It's x64 and x86.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

The TGA code isn't going to change on XP vs. 7, it is self-contained and not using any OS functionality. It's not a .NET issue, as the code is not using any of the framework functionality either. And it's certainly not a 32-bit vs. 64-bit issue*. Paint.NET has always saved the rows in "upside-down" order because that's how TGAs are conventionally saved, and many other apps just assume this without checking the image header flags. It's just like how BMPs are "upside-down" (even though, mathematically speaking, they are upside-up). The TGA loading code will correctly respect both X and Y mirror flags in the TGA image descriptor. "Y mirrored" in this case means that the image is saved top-down.

If you're still not convinced, use Reflector to go look at PaintDotNet.Data.dll, at the TgaFileType sitting in the PaintDotNet.Data namespace, at the SaveTga() method.

I don't doubt you. It is just very strange that I did not have any issues under Windows 7. My TGA loading code merely reads the image data into a buffer and does the BGR to RGB conversion. I wasn't even aware of the image descriptor. Not a hard problem to fix.

"Mathematically Speaking" Huh. I never thought of it that way. Considering the content and the expected usage, I wouldn't expect the mathematical "up" to be the up used.

* btw there is no such thing as x32. It's x64 and x86.

Pardon. You are correct. I keep forgetting this.

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.

 Share

×
×
  • Create New...