Jump to content

Converting transparent/blended pixels around image.


Recommended Posts

Hey guys, I am working on a little project for an old game to update the art assets. My issue is that the game is so old that it doesn't like transparent pixels. What happens is, when I am done resizing and converting my image files, the transparent/blended pixels that surround the art (likely a result of using the anti aliasing tool in paint.net) convert to the color of the background (the game extensively uses blue-screens around art to be able to inset various pictures into different scenes), which adds an ugly blue outline effect to the art. Here are pictures of the before and after.

 

Before loaded

Before.png.cd0e78a4a87e58d74eac7700d937c8c2.png

 

 

In-game

1263412196_Ingame.png.087435a78204c49face863841202fba5.png

 

My assumption is that the shades of blue that are near the character are slightly different then the rest of the rest of the blue-screen, which makes the game think that those blues are part of the art. What I would like to know is, what is the best solution to solve this issue? Are there tools within paint.net that can convert to the best match for the transparent pixels before they are merged with the background layer (would that even look good?), or possibly some plugin that would solve this? I really want to avoid putting any kind of outline around the art, so if there's anything I can do eliminate the transparent pixels without doing much to the quality of the picture, that would be my ideal solution.  I have saved each of my art assets individually, so if I have to redo certain parts to get the effect I desire that's totally ok. I just want to make sure that I do this the best and most efficient way possible.

 

Looking forward to hearing any suggestions you guys might have,

Thanks!

Link to comment
Share on other sites

I'm not quite sure why the game is doing what it's doing, but my guess is that that game has only transparent and opaque pixels, nothing in between, and the that semi-transparent pixels on the edge are causing the problem. If that is the problem, the solution is to convert the image to only have fully opaque and fully transparent pixels. Two ways to do that are to use BoltBait's Transparency adjustment, or Red Ochre's Alphathreshold effect.

 

To use the Transparency adjustment, move the slider all the way up to Opaque, while leaving "Ignore transparent pixels" checked.

 

To use Alphathreshold, move both sliders fully left, then move the "lo threshold" up (the high threshold will follow automatically) until the best edge is achieved. The "high threshold" control can be moved dowward if you overshoot.

 

Making pixels either fully transparent are opaque will result in a jaggy edge, but that's unavoidable.

 

EDIT: I'm not certain I understand the problem, because I'm not sure what the image of Han Solo against the blue background represents. Is it an image, with transparency, on one layer against a blue background layer; or is it a singe layer with both the imarge and the blue background color?

Link to comment
Share on other sites

Thank you for the response, these solutions seem promising, I am going to test them very soon.The game basically uses a solid blue color as a blue-screen on all the character images among other things. They are saved as bmps, so this is a rather obsolete method of having "transparent" borders around the characters. The game loads up a scene be it the millennium falcon, or a cantina, etc, and takes I believe the color of the pixel in the very bottom left or right corner, and removes all instances of that color. This is fine and dandy until you deal with pixels that are slightly different (byproduct of the transparent pixels). In that case, the game ignores those and assumes it is part of the art to be displayed. The resolution of the art files is super low, like 400x200 for the largest art (the ones that I have shown) so jagginess isn't exactly an issue to me as long as the color around the edges reasonably matches the rest of the character so that there is no "outline" effect.

 

In other words, the blue you see in the Han is post flattening of the image. The bitmap is stored WITH the blue, and not as a separate layer.

 

Edit: First solution worked like a charm, Ill text the other one soon, but I think that this is exactly the solution I needed. Thanks again!

Edited by Triforce919
Link to comment
Share on other sites

Oh, I think I understand. The blue is used by the game to represent the pixels to be made transparent. If that's the case, then the proposed solutions should work. The problem -- as you probably concluded yourself -- is that when you prepare the images, the semi-transparent pixels are blended to blue, so they're partially blue, but not blue enough to be treated as transparent by the game.

Link to comment
Share on other sites

On 6/29/2020 at 7:08 PM, MJW said:

Oh, I think I understand. The blue is used by the game to represent the pixels to be made transparent. If that's the case, then the proposed solutions should work. The problem -- as you probably concluded yourself -- is that when you prepare the images, the semi-transparent pixels are blended to blue, so they're partially blue, but not blue enough to be treated as transparent by the game.

Until my plug-in is ready, getting rid of the blue is easy with my free site:

PixelDatabase.Net

A free online text based image editor

 

Hide Pixels Where
BlueMinDifference > 54

 

BlueMinDifference means the pixels affects will be the ones that if you take the value for Blue and subtract the minimum value of Red, Green or Blue and the result is > 54. Through trial and error the 54 seemed to be the magic number.

 

I will try and get the plug-in done this week, as I use Paint.Net every day for 15 years, and I wrote my site for the things Paint.Net doesn't do easily.

 

To make those blended pixels all blue (from the original image):

 

Update

Set Color Blue

Where

BlueMinDifference > 54

 

It will crank up the blue.

 

I can't tell a difference looking, but you could try using the bottom image and see if it if it works better since the blended pixels should be blue now.

 

Blue Removed.png

BlendedBetter.png

Edited by DataJuggler
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...