Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

PNG V TGA regarding transparencies

Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
12-13-2009 11:05
From: Carbon Philter
I'm running Windows 7 64bit and had the no tga problem in Explorer. I'm also running PSP rel. X as a 32bit app. and seemed to have a problem opening jp2 files so d/loaded the thumbplug and also found an install called FastPictureViewerWICCodecPack.msi on the web. Not sure which one did the trick but tga's now appear in xplorer


I have to assume the codec pack is what did the trick, unless you're using the 32-bit version of Explorer.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Pygora Acronym
User
Join date: 20 Feb 2007
Posts: 222
12-13-2009 17:59
From: Rolig Loon
Not at all, Pygora. That's a good, rational presentation. I made the "partisan" comment on what was a bad day, but I was thinking back over several times when the PNG/TGA discussion has been tinged with unpleasant rhetoric, similar to the "My Apple (PC) is better than your PC (Apple)" nonsense that people used to get nasty about. My tired brain was trying to avoid going there. Guess I missed. :(


Hi Rolig. That's completely understandable to me, I have those days myself. I didn't want to deviate into the PC/Mac discussions either, but I was worried that taking up the format comparison could be construed to be doing so in light of your post. I am sure I could have stated that I wasn't trying to get into a religious discussion in a much better way, so I'm glad you understood I wasn't trying to be nasty or anything.
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
12-13-2009 23:39
From: Chosen Few
Thanks for explaining. What you've outlined here is not only NOT a bug, it also has nothing to do with Photoshop at all. I'll explain.
Here we go again.

Yes, you provide endless amusement.

From: someone
Now, step 5 is where you start to change things. When you upload the image to SL, you introduce the viewer's JPEG2000 conversion utility, which intentionally bleeds the coloring, in order to prevent haloing. This is NOT a bug. Think of it as SL's version of the Solidify filter. It exists for good reason. It's the ONLY reason PNG's with simple transparency end up halo-free when converted to SL textures.


This bug has nothing all to do with JPEG 2000, and is reproducible with a variety of conversions, and in programs capable of seeing the PNG channels without conversion, none of which involve PNG or make attempts to "enhance" the image without asking.

Virtually identical images created in a variety of other drawing and painting programs do *not* exhibit this behavior. Even Adobe Illustrator does not exhibit this bug with PNG files exported from it, it is a problem with Photoshop's PNG exporter.

From: someone
SL textures are JPEG2000 files, which utilize alpha transparency. When you convert to alpha transparency from any type of visual transparency, be it the layer transparency in a PSD or TIFF, or the indexed transparency in PNG or GIF, (hey, that rhymed!) the visually transparent areas will be filled in with solid color, usually white. If you don't first bleed the coloring from the opaque areas into the transparent areas, you inevitably will end up with a halo. The person who wrote the PNG-to-JPEG2000 converter for SL (who was not a Linden, by the way) was smart enough to account for this.


No, this has nothing to do with "halos" and it is entirely about PHotoshop's tendency to write garbage into the RGB channels when it saves in that format. What we are talking about here is not some sort of small edging, for that to be the case it would have to overstep consistently, and it does not do that in any sort of useful way.

From: someone
As for your alternate step 6, I don't use ImageMagik, so I've never tried it. But by the sound of it, the exact same process in play.

Nope, not at all, it's a simple straightforward bitmap conversion. And again, equivalent conversions of similar PNG files sourced from other programs do not exhibit this behavior. Even other programs using Photshop-sourced PSDs do not exhibit this probloem. It is a bug in Photoshop's PNG export plugins.

From: someone
It bleeds the edge coloring of the opaque elements into the transparent areas, in order to prevent haloing.

No, this is not a bleed, this is digital noise, it doesn't overlap in any sort of useful pattern or by any consistent amount.

From: someone
Your mention of unrasterized vectors in the working document as a trigger for this behavior could not in any way be possible.


That sounds well and good, except that it is a reproducible bug (and we did send in repros).

From: someone
First, the working document is not the PNG, the PNG is not the JPEG2000 that SL uploads, and the JPEG2000 is not the TGA you download.

None of that really has to do with the problem, you're missing the forsst for the trees.

[quote4r] (Or skip the JPEG2000 part, if you're doing the ImageMagik thing.) There's simply no way that ANYTHING present in the working document inside Photoshop could possibly affect how a third party program converts the outputted PNG to any other format.[/quote]

*Third party software is not doing this.* Photoshop's own PNG conversion filter is doing this. This bug is specific to the PNG save feature in Photoshop. If you take Photoshop out of the loop when it comes time to create a PNG, the problem goes away.

The only reason that conversions come into this at all is that Photoshop is unable to display all of the PNG channels separately on its own. That's not a bug, just a missing feature in PS The third party conversions are not introducing this abberation, the artifacts identical when fed into a variety of programs using independent code.

From: someone
SL and ImageMagik have no way of knowing or caring what techniques you did or did not utilize in Photoshop before you spit out the PNG file.

That's why this is a problem, Photshop trashes the RGB channels when it exports these images to PNG.

From: someone
Second, as soon as you output to a flat format like PNG, all vectors are rasterized anyway. There's no such thing as a vector in a PNG file.


Photoshop is messing up all on its own. Its own export filter is writing these shapes incorrectly.

From: someone
None of this is what Pygora seemed to be describing. He said, "When Photoshop then saves transparent PNGs the RGB data in the transparent areas is given a simple fill color." The implication was that Photoshop itself was solidifying the transparency. He didn't say anything about using other conversion programs to do it.


What Pygora described is one of the variations of exactly the same thing I described. Sometimes the bug in Photoshop's PNG export filter will fill the whole of that area. Sometimes it will scribble lines as in the quick example I threw together. They are simply different manifestations of the same bug.
Pygora Acronym
User
Join date: 20 Feb 2007
Posts: 222
12-14-2009 00:40
From: Chosen Few
I'm not sure where you're getting that...


I feel you man. I felt the same way reading your response. I saw my name quoted but then reading your replies I had to wonder if you were reading what I said, or were just out to find as many ways to misrepresent what I was saying as possible then respond to that. Saving layers in TGAs? Really? I almost hesitate to go further if that's the sort of 'discussion' I can expect.

If it helps I'm using CS3. where I said PNG, I meant PNG (the plugin is called SuperPNG too) where I said TGA I meant TGA. When I said 'alpha channel' meant the alpha channel in the channel palette, not alpha transparency generated via other means. Although I could have slipped up on the last bit and inadvertently caused confusion.

From: Chosen Few
I'm not sure "greater utility" is the best way to put it. I'll agree that PNG does have a wider range of purposes and capabilities than TGA. But more options doesn't always mean more usability. Sometimes less is more. The biggest reason TGA has been the staple of the texturing industry for decades is precisely because it's so simple. It's just a bitmap, nothing more, nothing less.


What definition are you using which makes TGA a bitmap, but PNG somehow not? Or were you trying to make a different point than that?

My argument of utility is based on the general range of use that PNG affords as a format compared to TGA. It's a point you actually seem to agree with too. And I tried to make it clear I was not limiting it to the context of use for SL. If you personally have different, more important, criteria, such as which is simpler for you to use, then you will naturally have a different view on it, no question. But I tried to clearly define my basis so others could calibrate from that.

If you want to narrow the evaluation range for which to judge PNG and TGA I personally would need a clearer definition of what is meant by 'texture industry'. TGA is very useful in the context of delivering textures from an image editor to SL, no doubt. But it is an older format that has been eclipsed by formats such as DDR in 'next gen' games and other realtime graphics that wring every ounce of power out of video cards. Floating point formats can offer much more as textures for high end offline rendering. There are other realms to which I can see the term 'texture industry' applying to, but I wouldn't be as familiar with those.

And by 'eclipsed' I am not saying it's never used in those applications, but that there are,
in general, better formats based on criteria beyond which is the simplest. Even SL converts TGA (and PNG) over into something else.

From: Chosen Few
PNG can be a little too variable for its own good at times. There are a lot of bells and whistles in it that aren't at all useful for texture work. This creates a relatively large margin for error. There's nothing worse than spending hours or days baking a texture set, only to realize afterward that the specifics of the format you chose are incompatible with whatever platform you made them for. Sure, you can just do a batch conversion to fix the problem (usually), but if you've already delivered the wrong files, you not only look like an idiot, but you can end up slowing down an entire content development pipeline while everyone's waiting for you to fix your mistake. Not cool.

With TGA, that's never an issue. You deliver a texture pack in TGA format, and you know for a fact it's going to be usable.


The format is what it is. It does nothing for it's own good so I'm not sure what I should take away from such statements other than your seeming dislike of PNGs. Same with regarding it being too variable or that there are 'bells and whistles' that are not 'at all useful for texture work'. Indeed there could be, I guess, for certain people or texture work. If we knew the specific variability, 'bells and whistles' or 'texture work' in question there could be a possibility of folks judging for themselves one way or the other.

Wasted work is bad, but most of what I am seeing attributed to PNG's vaguely ominous 'large margin for error' (not understanding specifics, choosing platform incompatible formats, looking like an idiot) I would personally call 'user error,' or 'not understanding your tools,' or maybe 'bad client-developer communication.' If someone wants to suggest using PNGs lead to such things, it's their prerogative of course. For me concrete examples would sway me more then innuendo. I'm sure you have specific reasons and justifications, and it would be great if they were given so we can judge on merits.

Again, I'm not attempting to tell others how to work or what formats to use. Or to get into an "I right, ur wrong" pissing match, and I apologize if I'm coming across that way. I am merely attempting to provide good faith information to answer the original post or coax out reasonable discussions from others on the matter.

If someone wishes to give me clear examples of things I said that was unclear for them, or wish to discuss what I was trying to say, not what they assumed I meant, I would love the chance to be able clarify or rephrase.

But beyond that I feel that I might have stumbled into the PC vs Mac situation that Rolig warned of and have no desire to become mired in such things.
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
12-14-2009 01:20
From: Viktoria Dovgal
Here we go again.

Yes, you provide endless amusement.


I'm disappointed, Viktoria. Can we not have an intelligent discussion about this, without bringing in the insults? Come on. I thought you were better than this.

Look, If you've got information to share that proves anything I said was in error, GREAT!!!! Say as much politely. We're all here to learn from each other. I'll always welcome truth, especially it it shows me my own mistakes. But kindly just stick to the facts, and don't be insolent about it.

Notice when I contradicted your information, I did not say anything about you personally. I'd appreciate the same courtesy. No one needs to read this kind of drivel. Again, I really thought you were better than this, and would like to think so again. I invite you to step up.


As for the rest of what you said, would you care to cite any proof? After the way you started your post, and in the absence of any concrete facts, it's difficult to know whether to believe ANYTHING you've said. All appearances so far are that you've decided to make this personal for some reason, and that makes everything you've said suspect.


I can at the very least refute one of your points, if you yourself are at all interested in the truth of this. Whether you are you aren't, I'm sure other readers are. PNG's from Illustrator behave exactly the same way as those from Photoshop, when uploaded to SL, and then saved back out as TGA's. The colors bleed into the transparent areas. Try it yourself; you'll see.


In any case, even if what you claim is true in the smallest degree or the largest, it still doesn't change the fact that the "garbage", as you put it, is not visible until the point of conversion. Whichever one of happens to be right or wrong about the why's behind all this, that is the only point that really matters.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
12-14-2009 02:16
From: Pygora Acronym
I feel you man. I felt the same way reading your response. I saw my name quoted but then reading your replies I had to wonder if you were reading what I said, or were just out to find as many ways to misrepresent what I was saying as possible then respond to that. Saving layers in TGAs? Really? I almost hesitate to go further if that's the sort of 'discussion' I can expect.


Thanks for acknowledging that we're suffering from a failure to communicate, and that neither of us is out to be malicious toward the other. If you'd care to try to re-explain any of what you said so that I can better understand you, I'm all ears. I'm happy to reciprocate, if you'd like. :)


From: Pygora Acronym
If it helps I'm using CS3. where I said PNG, I meant PNG (the plugin is called SuperPNG too) where I said TGA I meant TGA. When I said 'alpha channel' meant the alpha channel in the channel palette, not alpha transparency generated via other means. Although I could have slipped up on the last bit and inadvertently caused confusion.


I'm really not sure where the confusion is coming from, which I guess is why it's confusion in the first place. :)

The behavior you described for PNG and TGA work flows and outcomes seems almost completely reversed to me. I'd love to find out why that is, and see if we can't straighten all this out.


From: Pygora Acronym
What definition are you using which makes TGA a bitmap, but PNG somehow not? Or were you trying to make a different point than that?


I wasn't trying to say a PNG file is not a bitmap. Every raster image is a bitmap, obviously. Perhaps my wording was poor, but the point I was trying to make is that TGA is among the simplest formats in existence. Yes, at the end of the day, PNG is a bitmap too, but it's also got a little more under the hood to it than just that much. That's all I meant.


From: Pygora Acronym
My argument of utility is based on the general range of use that PNG affords as a format compared to TGA. It's a point you actually seem to agree with too. And I tried to make it clear I was not limiting it to the context of use for SL. If you personally have different, more important, criteria, such as which is simpler for you to use, then you will naturally have a different view on it, no question. But I tried to clearly define my basis so others could calibrate from that.


No worries on this. We just seem to have differing preferences for wording. I think we both understand what the other meant. :)


From: Pygora Acronym
If you want to narrow the evaluation range for which to judge PNG and TGA I personally would need a clearer definition of what is meant by 'texture industry'. TGA is very useful in the context of delivering textures from an image editor to SL, no doubt. But it is an older format that has been eclipsed by formats such as DDR in 'next gen' games and other realtime graphics that wring every ounce of power out of video cards. Floating point formats can offer much more as textures for high end offline rendering. There are other realms to which I can see the term 'texture industry' applying to, but I wouldn't be as familiar with those.

And by 'eclipsed' I am not saying it's never used in those applications, but that there are,
in general, better formats based on criteria beyond which is the simplest. Even SL converts TGA (and PNG) over into something else.


It is true that a lot of the old rules of thumb are starting to go out the window these days with next gen games, so your point is well taken. My point really was that, for good or ill, PNG is not a format that texture artists tend to use very often, if at all. TGA, on the other hand, is what we pretty much always default to, in the absence of any specific instructions to the contrary. Simply put, it's hard to go wrong with TGA, whereas it is far more possible, even if still somewhat unlikely, to go wrong with more complicated and more variable formats like PNG. I hope that makes sense.


From: Pygora Acronym
The format is what it is. It does nothing for it's own good so I'm not sure what I should take away from such statements other than your seeming dislike of PNGs. Same with regarding it being too variable or that there are 'bells and whistles' that are not 'at all useful for texture work'. Indeed there could be, I guess, for certain people or texture work. If we knew the specific variability, 'bells and whistles' or 'texture work' in question there could be a possibility of folks judging for themselves one way or the other.


Don't get me wrong. I think PNG is fantastic format. As you well pointed out, it's one of the most robust and multi-purpose-capable image formats currently in use. It's great.

The phrase "for its own good" was meant metaphorically. I'll take a stab at putting it more literally. Anything with a lot of options opens up the possibility that the user might not always choose the best configuration for the task at hand. The presence of that possibility can at times make the thing with more options a less practical choice than an alternative with less options, when the given purpose is very specific, and when said alternative already happens to be well configured to suit that purpose.

If I'm using that format, then depending on the needs of the platform or application I'm creating the images for, there are many factors that I MIGHT need to consider. Should the image be interlaced? Is simple transparency OK, or should I include an alpha channel? Should I use indexed color or RGB(A)? What compression level should I choose? Etc., etc., etc. A lot of times, the answer to any or all of these questions will be that it doesn't matter. But sometimes it does matter.

The TGA format has remained in use for so long in 3D and film/video applications, largely because it barely has any options at all. It just is what it is, and it works.

Given the choice, and again, in the absence of specific instructions, I know TGA is pretty much always a safe way to go. I can't quite say the same for PNG.


From: Pygora Acronym
Wasted work is bad, but most of what I am seeing attributed to PNG's vaguely ominous 'large margin for error' (not understanding specifics, choosing platform incompatible formats, looking like an idiot) I would personally call 'user error,' or 'not understanding your tools,' or maybe 'bad client-developer communication.' If someone wants to suggest using PNGs lead to such things, it's their prerogative of course. For me concrete examples would sway me more then innuendo. I'm sure you have specific reasons and justifications, and it would be great if they were given so we can judge on merits.


You're certainly right that avoiding problems boils down to good communication. But not everyone is good at that, as we all know. For every client who's ever given me a detailed accounting of their specific needs, I could name 10 others who are more vague than a paraplegic mime. I guess I've just learned to play it safe is all. Again, it's hard to go wrong with the old standby, TGA.

All this said, please understand, I've got no particular affection for anything as mundane as a file format. So I hope no one interprets any of this as "Chosen is in love with TGA". Again, I've just learned from experience that it tends to be the safest way to go.


From: Pygora Acronym
Again, I'm not attempting to tell others how to work or what formats to use. Or to get into an "I right, ur wrong" pissing match, and I apologize if I'm coming across that way. I am merely attempting to provide good faith information to answer the original post or coax out reasonable discussions from others on the matter.


Understood. And no, you weren't coming off that way at all. I hope I wasn't either.

For what it's worth, it seems no matter what I say on this forum, there are a few people who constantly seem to want to believe such "pissing match" motivations are all I'm about. They seem to delight in catching me in mistakes, which I do of course make from time to time, just like everyone else. I always feel a little sorry for those people. I've never understood why anyone would have that particular motivation in the first place, let alone assume it must be present in others when it's not.

Again, let me thank you for being the type of person who would rather explore the root of miscommunication, and try to fix it, rather than just fly off the handle. That speaks volumes about you, as a person of character, and I appreciate that very much.


From: Pygora Acronym
If someone wishes to give me clear examples of things I said that was unclear for them, or wish to discuss what I was trying to say, not what they assumed I meant, I would love the chance to be able clarify or rephrase.


I've got one. What exactly did you mean when you talked about the transparent areas of a PNG getting filled in with solid color? I've never experienced that happen, unless converting to another format that does not support simple transparency. The way you worded it, or at least the way I read your wording, it sounded like you were saying it happens right away upon saving to PNG itself. Can you clarify what you actually did mean?

I think if we can start with that, the rest of what I didn't understand in your writing may just clear itself up. If not, I'll ask about a few more points.

Thanks. And again, please allow me to reciprocate. If there's anything you (or anyone else) didn't understand in what I said, ask away, and I'll do my best to try to explain.


From: Pygora Acronym
But beyond that I feel that I might have stumbled into the PC vs Mac situation that Rolig warned of and have no desire to become mired in such things.


I don't think any of us here are deliberately trying to take the conversation in that direction, so I wouldn't worry about it.

I think the danger is just in people assuming that that's what others might be trying to do. If we all can recognize that the others around us are just as noble and open minded about the discussion as we are, and have the good sense to ask about misunderstandings when something sounds odd, then the the discussion should remain useful and civil for the duration. I can already spot a few examples in my own writing where I probably failed to do that, so let me apologize for that, and commit right now to doing a better job of it from here on in.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Pygora Acronym
User
Join date: 20 Feb 2007
Posts: 222
12-20-2009 21:01
Sorry I didn't answer sooner. I'm glad we are still friends ;-)

Just to reiterate, what I hoped to convey in my post was this: Photoshop handles the process for creating alphas in PNGs different than TGA and thus there are folks who choose one over the other based on how they prefer to work. That's not an issue with the PNG format itself, but how they are implemented in the context of Photoshop. I don't think this is a controversial point.

In fact you can get an older version of a plug-in called SuperPng that allows alpha channel creation of PNGs the exact same way as is done with TGA rather than the process I am assuming you, Chosen, are referring to the standard PNG transparency creation way as WYSIWYG. This SuperPng changes that.

Now if you say you are not particular about any particular format I believe you. But some of your posts in those stickies up there can be read that at some point in the past this was perhaps not the case. You advocate TGA as the best format without reservations or qualifications in many cases. This is the only reason I was worried I might have stumbled into a religious debate.

From: Chosen Few

I've got one. What exactly did you mean when you talked about the transparent areas of a PNG getting filled in with solid color? I've never experienced that happen, unless converting to another format that does not support simple transparency. The way you worded it, or at least the way I read your wording, it sounded like you were saying it happens right away upon saving to PNG itself. Can you clarify what you actually did mean?


Yes, it does get filled right away. In Photoshop you might not notice this because it displays the pixels as being transparent in the UI when it reads in a PNG. PNG alpha is treated as a layer mask, while TGA alpha is loaded into the channel palette. Again I assumed this is what you meant by WYSIWYG. There is still RGB data there in the PNG even if Adobe decided not to have it displayed in the interface for some reason.

Simple test to verify what I'm saying: Open up a photographic color image in a vanilla Photoshop install, make a section transparent, then save as PNG. Go to an application that has an UI which handles PNG alpha the 'traditional' alpha channel way i.e. how you do it with TGA - Fireworks, GIMP or PS with the SuperPng plugin (an older version BTW, the newer seems to have gone to the PS UI way of displaying PNG) - and when you open you will be able to see the RGB channel data has been filled.

I'm not sure what you mean by 'simple transparency'. Do you mean PNG indexed color mode where a specific value is denoted as transparent? I'm referring to a standard RGB with alpha PNG here if that helps ya.
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
12-21-2009 00:19
In some ways, I feel like we're talking about two different programs that both happen to be titled "Photoshop". Much of the behavior you're describing for how Photoshop handles PNG's is just not anything I've ever seen it do.

If I create an image in Photoshop, erase part of it, and save it as PNG, the erased part stays visibly transparent in each and every program I open it in, whether it be Fireworks, SL, After Effects, Maya, GIMP, or what have you. It doesn't display as opaque with an alpha channel. Nothing is filled in. I'm all kinds of confused about why we could be seeing seeing such different behaviors.


I'm also puzzled about something else, which may or may not be related. It used to be you could save a PNG with an alpha channel from Photoshop. But now, the option to include alpha in the Save As dialog grays out as soon as PNG is selected. And the option isn't even there at all in the Save For Web dialog. Any idea when this change was implemented? I don't use PNG often enough to have kept track.


As for my encouragement of TGA in those older posts of mine that you refer to, if they now appear now to imply any undue religiosity when viewed through a lens of today, allow me to point out that most of the content in them was written long before PNG was usable for SL at all. Perhaps I should go back through and soften some wording, now that TGA is not the only reasonable choice for everyday usage for SL. But putting things in their proper historical perspective for a moment, I'm pretty sure you can understand why it was prudent to steer people almost exclusively toward TGA, when the only other available choices at the time were BMP, which has no transparency option, and JPEG, which is lossy.

I still don't recommend WYSIWYG workflow over alpha channel workflow, for reasons I've stated many, many times all over this forum. But recommended or not, I would never deny that the option is there for anyone who wants it. So it's likely I would have worded a few things a little differently had PNG, or any other lossless format that supports transparency, been there all along. But that just wasn't the case.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
1 2