Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Caracal on Sat 07/07/2012 15:45:10

Title: Black Pixel around the sprite
Post by: Caracal on Sat 07/07/2012 15:45:10
Hey everyone.
I got a real problem now and this does not result primarily out of my lacking scripting-knowledge.
https://dl.dropbox.com/u/87581860/Black%20pixel.png
I was working on a new game and I noticed that there is a nasty black-pixel area around the sprites…
The sprite files are PNG and the black area is actually empty. I have worked on several projects now
and everything worked just fine. This is the first time that something like this occurs.
I am desperate, what might the problem be? Did anyone ever have the same issue?
Is there a way to remove this problem?
Title: Re: Black Pixel around the sprite
Post by: Khris on Sat 07/07/2012 17:15:43
There seems to be something wrong with the png files themselves; it doesn't look like an AGS-related error.
Could you upload one of the sprites for us to take a look at?

By default, AGS makes the color transparent it finds in the sprite's top left corner, did you make sure the sprites' background uses only one color?
Title: Re: Black Pixel around the sprite
Post by: EchosofNezhyt on Sat 07/07/2012 17:22:08
It looks like your sprite's alpha is all wonky. Make sure that the area around the sprite is all one color or just delete the area around the sprite and import and click leave as is.

I accidentally did this before with a gui.
Title: Re: Black Pixel around the sprite
Post by: Alan v.Drake on Sat 07/07/2012 17:31:30
Check that you're correctly saving the png with alpha channels and that the game project is in 32 bit. When you import the image it should ask you if preserve the alpha channel, if so click yes, if not one of those conditions is not meet.

- Alan
Title: Re: Black Pixel around the sprite
Post by: Kastchey on Sat 07/07/2012 18:15:49
I encountered this issue a few times while importing graphics in PNG format. For some reason, AGS sometimes incorrectly reads color values in PNG and only PNG (as far as I noticed, at least) even if the image has no alpha channel. Try converting your PNG frames to GIF, it always does the trick for me if this problem occurs.
Title: Re: Black Pixel around the sprite
Post by: steptoe on Sun 08/07/2012 08:15:39
Is it meant to be this?:

(http://i1181.photobucket.com/albums/x423/qikfire/lady.png)

Also, the edging was not tight enough to the sprite which gives those nasty pixel edges.

Saved as PNG.

rather than this?:

(http://i1181.photobucket.com/albums/x423/qikfire/lady_old.png)


Title: Re: Black Pixel around the sprite
Post by: arj0n on Sun 08/07/2012 14:57:57
Quote from: steptoe on Sun 08/07/2012 08:15:39
Is it meant to be this?
Yes.
Title: Re: Black Pixel around the sprite
Post by: Caracal on Sun 08/07/2012 15:52:48
Quote from: Khris on Sat 07/07/2012 17:15:43
There seems to be something wrong with the png files themselves; it doesn't look like an AGS-related error.
Could you upload one of the sprites for us to take a look at?
https://dl.dropbox.com/u/87581860/walk%20front%203.png
This is the plain PNG file.
I usually keep the backgrounds empty, this is the major advantage to JPG (besides some others). The strange thing is that i importet this exact PNG into another game project i have been working on, and it worked perfect there. Maybe i screwed something in the global skript (trying to work on a way to get the "ultimate cursor" untill you gave me your code) and thereby i damaged something. I dont know but its really strage because in other game projects... AGS doesent do this with this particular PNG.
But the background of this file is empty. Not even white just plain empty and this usually worked, so far...
Title: Re: Black Pixel around the sprite
Post by: Caracal on Sun 08/07/2012 16:04:15
Quote from: Kastchey on Sat 07/07/2012 18:15:49
I encountered this issue a few times while importing graphics in PNG format. For some reason, AGS sometimes incorrectly reads color values in PNG and only PNG (as far as I noticed, at least) even if the image has no alpha channel. Try converting your PNG frames to GIF, it always does the trick for me if this problem occurs.
Well i did this and now it works. But just saving them as Gif wont solve the problem. I still wonder why ags will accept the same PNG files in other projects but not in this particular one...
Its strange. But thanks for the hint though now everything works and i can go on! :-)
Title: Re: Black Pixel around the sprite
Post by: Khris on Sun 08/07/2012 18:31:45
The important difference would be the game's color depth. 8bit limits the game to 256 colors, 16bit is standard and 32bit is needed to use alpha-channels.