Png
Moderators: Shine, Insert_witty_name
use photoshop to make transparent pngs.
but keep in mind that luaplayer can only do full transparency on the pngs. there is no semi-transparency yet. in my opinion this should be put in the player in future versions, because the graphics look really crappy without anti-aliasing. i heard somewhere that they are working on it, though.
but keep in mind that luaplayer can only do full transparency on the pngs. there is no semi-transparency yet. in my opinion this should be put in the player in future versions, because the graphics look really crappy without anti-aliasing. i heard somewhere that they are working on it, though.
what if you dont have photoshop? my program shows a checker board for transparent area but when you save it as .png it turns the transparent area into white. are there any free programs that i can use because i dont want to pay $800 dollars to make an inch of a picture transparent.
If i do save it in my program an then run the lua it is just a bunch of boxes with lines. Is there away around this problem? Even if i open the picture and dont do anything, then resave, it it will still be lines. Is there a code imbedded in the .png?
If i do save it in my program an then run the lua it is just a bunch of boxes with lines. Is there away around this problem? Even if i open the picture and dont do anything, then resave, it it will still be lines. Is there a code imbedded in the .png?
I just wrote a function that converts all background in a solid color to transparency. The code is given below.
Write a couple of statements to do this...
PS: You don't have to buy $800 software just to do the job. Hail to Lua Player! :)
PSS I made up the word, transparentize. What a better word is there?
PSSS The function will be included in my LPut library.
PSSSS ...er, never mind. :)
Code: Select all
function Image:transparentize(bgColor)
local p
local transparent = Color.new(0,0,0,0)
local result = Image.createEmpty(self:width(), self:height())
for x = 0, self:width()-1 do
for y = 0, self:height()-1 do
p = self:pixel(x, y) -- returns a color
if p == bgColor then
result:pixel(x, y, transparent)
else
result:pixel(x, y, p) -- copy the same color
end
end
end
return result
end
Code: Select all
black = Color.new(0,0,0) -- solid color (for an example)
newImage = oldImage:transparentize(black)
PSS I made up the word, transparentize. What a better word is there?
PSSS The function will be included in my LPut library.
PSSSS ...er, never mind. :)
Geo Massar
Retired Engineer
Retired Engineer
tiles = Image.load("tiles.png")
figure = Image.load("figure.png")
function Image:setTransparentColor(color)
local p
local transparent = Color.new(0,0,0,0)
local result = Image.createEmpty(self:width(), self:height())
for x = 0, self:width()-1 do
for y = 0, self:height()-1 do
p = self:pixel(x, y) -- returns a color
if p == bgColor then
result:pixel(x, y, transparent)
else
result:pixel(x, y, p) -- copy the same color
end
end
end
return result
end
black = Color.new(0,0,0) -- solid color (for an example)
newImage = Image:setTransparentColor(black)
..............
this is what i have. it keeps saying now that it cant perform arithmatic on a nil value. Any ideas?
figure = Image.load("figure.png")
function Image:setTransparentColor(color)
local p
local transparent = Color.new(0,0,0,0)
local result = Image.createEmpty(self:width(), self:height())
for x = 0, self:width()-1 do
for y = 0, self:height()-1 do
p = self:pixel(x, y) -- returns a color
if p == bgColor then
result:pixel(x, y, transparent)
else
result:pixel(x, y, p) -- copy the same color
end
end
end
return result
end
black = Color.new(0,0,0) -- solid color (for an example)
newImage = Image:setTransparentColor(black)
..............
this is what i have. it keeps saying now that it cant perform arithmatic on a nil value. Any ideas?
-
- Posts: 17
- Joined: Mon Oct 03, 2005 5:00 am