forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Png

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
maweryck



Joined: 16 Oct 2005
Posts: 1

PostPosted: Mon Oct 17, 2005 12:53 am    Post subject: Png Reply with quote

HI ALL

How to create the transparency in an image png for the psp?
Back to top
View user's profile Send private message
ShUr1k3n



Joined: 16 Oct 2005
Posts: 42

PostPosted: Mon Oct 17, 2005 2:15 am    Post subject: Re: Png Reply with quote

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
View user's profile Send private message Send e-mail
LuMo



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Mon Oct 17, 2005 2:30 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
MasterQ



Joined: 01 Oct 2005
Posts: 7

PostPosted: Mon Oct 17, 2005 6:24 am    Post subject: Reply with quote

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
View user's profile Send private message
haust



Joined: 01 Oct 2005
Posts: 25
Location: France

PostPosted: Mon Oct 17, 2005 9:24 am    Post subject: Reply with quote

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
View user's profile Send private message
MikeHaggar



Joined: 18 Jul 2005
Posts: 116

PostPosted: Tue Oct 18, 2005 12:44 am    Post subject: Reply with quote

Erhm... Save as 24 bit...
Back to top
View user's profile Send private message
link



Joined: 19 Oct 2005
Posts: 61

PostPosted: Wed Oct 19, 2005 6:34 am    Post subject: Reply with quote

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
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Wed Oct 19, 2005 7:21 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
link



Joined: 19 Oct 2005
Posts: 61

PostPosted: Wed Oct 19, 2005 7:40 am    Post subject: Reply with quote

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
View user's profile Send private message
haust



Joined: 01 Oct 2005
Posts: 25
Location: France

PostPosted: Wed Oct 19, 2005 10:11 am    Post subject: Reply with quote

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
View user's profile Send private message
LuMo



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Wed Oct 19, 2005 6:37 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
link



Joined: 19 Oct 2005
Posts: 61

PostPosted: Wed Oct 19, 2005 11:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
LuMo



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Thu Oct 20, 2005 12:15 am    Post subject: Reply with quote

<removed>
_________________
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Back to top
View user's profile Send private message Visit poster's website
jimjamjahaa



Joined: 03 Oct 2005
Posts: 17

PostPosted: Thu Oct 20, 2005 6:16 am    Post subject: Reply with quote

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
View user's profile Send private message
link



Joined: 19 Oct 2005
Posts: 61

PostPosted: Thu Oct 20, 2005 8:49 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group