| View previous topic :: View next topic |
| Author |
Message |
maweryck
Joined: 16 Oct 2005 Posts: 1
|
Posted: Mon Oct 17, 2005 12:53 am Post subject: Png |
|
|
HI ALL
How to create the transparency in an image png for the psp? |
|
| Back to top |
|
 |
ShUr1k3n
Joined: 16 Oct 2005 Posts: 42
|
Posted: Mon Oct 17, 2005 2:15 am Post subject: Re: Png |
|
|
| maweryck wrote: | HI ALL
How to create the transparency in an image png for the psp? |
Hi maweryck,
just use Paint Shop Pro, or any Image Editor that can "Write" PNG format.
ShUr1k3n |
|
| Back to top |
|
 |
LuMo
Joined: 21 Aug 2005 Posts: 410 Location: Austria
|
Posted: Mon Oct 17, 2005 2:30 am Post subject: |
|
|
not sure if every image editor can do that (guess paint can't although it can read andwrite png's)
Photothop can do it, thats for sure :)
greets _________________ "Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com |
|
| Back to top |
|
 |
MasterQ
Joined: 01 Oct 2005 Posts: 7
|
Posted: Mon Oct 17, 2005 6:24 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
haust
Joined: 01 Oct 2005 Posts: 25 Location: France
|
Posted: Mon Oct 17, 2005 9:24 am Post subject: |
|
|
| ok, so how can i save 16 bits png files with photoshop. Currently I can only save in 4, 8 or 24 bits.... |
|
| Back to top |
|
 |
MikeHaggar
Joined: 18 Jul 2005 Posts: 116
|
Posted: Tue Oct 18, 2005 12:44 am Post subject: |
|
|
| Erhm... Save as 24 bit... |
|
| Back to top |
|
 |
link
Joined: 19 Oct 2005 Posts: 61
|
Posted: Wed Oct 19, 2005 6:34 am Post subject: |
|
|
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? |
|
| Back to top |
|
 |
KawaGeo
Joined: 27 Aug 2005 Posts: 191 Location: Calif Mountains
|
Posted: Wed Oct 19, 2005 7:21 am Post subject: |
|
|
I just wrote a function that converts all background in a solid color to transparency. The code is given below.
| Code: |
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
|
Write a couple of statements to do this...
| Code: |
black = Color.new(0,0,0) -- solid color (for an example)
newImage = oldImage:transparentize(black)
|
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. :) _________________ Geo Massar
Retired Engineer |
|
| Back to top |
|
 |
link
Joined: 19 Oct 2005 Posts: 61
|
Posted: Wed Oct 19, 2005 7:40 am Post subject: |
|
|
Im i supposed to put this into my game code or run it sepperate? On psp or on PC?
PLEASE specify instructions. Where should i put the image that needs transparancy?
Give me some instructions PLEASE of what i should do. |
|
| Back to top |
|
 |
haust
Joined: 01 Oct 2005 Posts: 25 Location: France
|
Posted: Wed Oct 19, 2005 10:11 am Post subject: |
|
|
from what I see, you can just copy-paste the code in your game, load your image then transparentize it by specifying the transparency color and it should be ok.
Note that the transparency color should not be used in your non-transparent part of your image....
If I'm wrong someone will correct me. |
|
| Back to top |
|
 |
LuMo
Joined: 21 Aug 2005 Posts: 410 Location: Austria
|
Posted: Wed Oct 19, 2005 6:37 pm Post subject: |
|
|
how about that?
rename transparentize to setTransparentColor(color)
usually Color.new(255,0,255) is used as transparency mask, cause its used in very few cases ;)
greets
lumo _________________ "Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com |
|
| Back to top |
|
 |
link
Joined: 19 Oct 2005 Posts: 61
|
Posted: Wed Oct 19, 2005 11:00 pm Post subject: |
|
|
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? |
|
| Back to top |
|
 |
LuMo
Joined: 21 Aug 2005 Posts: 410 Location: Austria
|
Posted: Thu Oct 20, 2005 12:15 am Post subject: |
|
|
<removed> _________________ "Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com |
|
| Back to top |
|
 |
jimjamjahaa
Joined: 03 Oct 2005 Posts: 17
|
Posted: Thu Oct 20, 2005 6:16 am Post subject: |
|
|
| Quote: |
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.
|
gimp
it is teh ownage |
|
| Back to top |
|
 |
link
Joined: 19 Oct 2005 Posts: 61
|
Posted: Thu Oct 20, 2005 8:49 am Post subject: |
|
|
| man gimp is awesome!!!! it free and you can do LOTS with it!!!! at first i expected a paint program or something since it was free but you can do just about anything!!! I highly recomend gimp to anyone |
|
| Back to top |
|
 |
|