Grey border around img when on black background.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Jeeper
Party member
Posts: 611
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Grey border around img when on black background.

Post by Jeeper »

Anyone else have the issue that whenever you draw a .png on a black background, you get a unwanted grey outline to your picture. Is there some kind of blend setting or AA setting that you can turn of in order to fix this?
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Grey border around img when on black background.

Post by raidho36 »

Try putting a black layer underneath your picture in the editor and see if it works.
User avatar
Jeeper
Party member
Posts: 611
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Re: Grey border around img when on black background.

Post by Jeeper »

raidho36 wrote:Try putting a black layer underneath your picture in the editor and see if it works.
No issues there, just tried it. :S

I get this issue with pictures from Gimp and PS. But only ingame.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Grey border around img when on black background.

Post by raidho36 »

What exactly the artifact looks like? A halo surrounding the silhouette or thin gray rectangle surrounding the sprite? Be more specific about this please.
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: Grey border around img when on black background.

Post by micha »

I had the same issue. The problem is that the transparent background is technically white. What you need is, like raidho said, a black and transparent background.
In inkscape it is possible to set the background to black-transparent. Don't know how to do it in gimp. You can try (for an experiment) to add a background in black, that is almost transparent (transparent sometimes gets removed completely): Set the alpha value to the smallest value larger than zero. That worked for me.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Grey border around img when on black background.

Post by raidho36 »

In GIMP, there's an option to keep transparent pixels' colors. Dunno for PS.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Grey border around img when on black background.

Post by Jasoco »

Also make sure to draw your image at floored coordinates by using math.floor on its X and Y. See if that helps.
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: Grey border around img when on black background.

Post by Germanunkol »

As micha mentioned, in inkscape you can simply use the image preferences to set the background transparency to (0,0,0,0) (instead of (255,255,255,0)

Solution in Gimp (for .png images):
  • Open file
  • Select color picker tool
  • Confirm with color-picker that transparency is (255,255,255,0) (Hold shift while clicking to bring up Color Picker Information Window)
  • Make a new layer
  • Fill new layer with black and move it to the very bottom
  • With the layer selected, go to "Colors"->"Color to Alpha", choose black and confirm
  • Merge the two layers ("Layer"->"Merge Down")
  • Confirm with color-picker-tool that background color is now (0,0,0,0)
  • Victory dance
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
User avatar
Jeeper
Party member
Posts: 611
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Re: Grey border around img when on black background.

Post by Jeeper »

Germanunkol wrote:As micha mentioned, in inkscape you can simply use the image preferences to set the background transparency to (0,0,0,0) (instead of (255,255,255,0)

Solution in Gimp (for .png images):
  • Open file
  • Select color picker tool
  • Confirm with color-picker that transparency is (255,255,255,0) (Hold shift while clicking to bring up Color Picker Information Window)
  • Make a new layer
  • Fill new layer with black and move it to the very bottom
  • With the layer selected, go to "Colors"->"Color to Alpha", choose black and confirm
  • Merge the two layers ("Layer"->"Merge Down")
  • Confirm with color-picker-tool that background color is now (0,0,0,0)
  • Victory dance
Thanks a lot! It worked like a charm. :)
Post Reply

Who is online

Users browsing this forum: No registered users and 38 guests