QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

Converting and using graphics to .c

This is a discussion on Converting and using graphics to .c within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; I've heard this is possible. I've converted a .bmp to a .c file, but I didn't know how to use ...

Reply
 
LinkBack Thread Tools
Old 05-24-2006, 07:16 PM   #1

 
Zettablade's Avatar
 
Join Date: May 2006
Location: Programming or Farming Mudkips
Posts: 657
Trader Feedback: 0
Default Converting and using graphics to .c

I've heard this is possible. I've converted a .bmp to a .c file, but I didn't know how to use it. What tool can convert a .png to a .c file. Then how can I use it in my program?
Zettablade is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-24-2006, 07:17 PM   #2
TheMarioKarters
Guest
 
Posts: n/a
Default

Erm.
.c isn't an image format
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-24-2006, 07:26 PM   #3

 
Zettablade's Avatar
 
Join Date: May 2006
Location: Programming or Farming Mudkips
Posts: 657
Trader Feedback: 0
Default

Quote:
Originally Posted by TheMarioKarters
Erm.
.c isn't an image format
I know, but I'm still wanna know how this is done. Or at least how to encrypt images.
Zettablade is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-24-2006, 07:27 PM   #4
TheMarioKarters
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Zettablade
I know, but I'm still wanna know how this is done. Or at least how to encrypt images.
Ah, I got you now.
Sorry, I can't help you with that.
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-24-2006, 07:28 PM   #5

PSP Developer
 
alatnet's Avatar
 
Join Date: Oct 2005
Real First Name: Alex
Location: ~* Confidential *~
Just Played: N/A
Posts: 839
Trader Feedback: 0
Default

.c isn't an image format, it is a source code. Try doing a put pixel in a loop to the screen using the picture source array.
__________________

"Every team needs an idealistic person (whether they are a noob or a pro), my team doesn't have one cus im the idealistic founder."-me
Anime/Manga and Fanfiction is my inspiration!

Creator of:
- PSPSDK makefile creator - Lua Prompt - Animated Sprite Class\Library for Lua - Gmax2PSP -
alatnet is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-24-2006, 07:45 PM   #6
 
Yeldarb's Avatar
 
Join Date: Jul 2005
Posts: 984
Trader Feedback: 0
Default

There's a tool that comes with the toolchain, bin2o I think it is. Try it out. Shine also had a Java program that did it. I included it with my Snakman releases (check out version .3, it has it integrated into the Makefile)
__________________
[url=http://www.barbdwyer.com/footer.php][img]http://www.barbdwyer.com/8Ball.jpg[/img][/url]
[FONT=Verdana][SIZE=1]
[b]PSP Developer Resource Site:[/b] [url=http://www.psp-programming.com]PSP-Programming.com[/url]

[b]Other:[/b] [url=http://wake-boarding.org]Wakeboarding[/url], [url=http://water-skiing.org]Waterskiing[/url], [url=http://wake-surfing.org]Wake Surfing[/url], [url=http://www.guitarhero-4.com]Guitar Hero IV[/url][/SIZE][/FONT]
Yeldarb is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-24-2006, 08:22 PM   #7

total-Z
 
youresam's Avatar
 
Join Date: Jul 2005
Location: texas
Posts: 2,803
Trader Feedback: 0
Default

http://ps2dev.org/psp/Tools/Mach-one_PSP_Converter
That will convert BMP to raw C code.
When I did that, I used pg to display the images.
__________________
牧来栠摩琠敨映汩獥
PSN: youresam
From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
youresam is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-24-2006, 08:23 PM   #8

Developer
 
Join Date: Mar 2006
Posts: 1,026
Trader Feedback: 0
Default

As Yeldarb mentioned, bin2o is the tool you want, it comes with the PSPSDK.

It converts your RAW file to an .o file, which you can add to your makefile which will then be added to your eboot.

Check out this link.

http://forums.ps2dev.org/viewtopic.p...ighlight=bin2o
Insert_Witty_Name is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-24-2006, 08:26 PM   #9

 
Zettablade's Avatar
 
Join Date: May 2006
Location: Programming or Farming Mudkips
Posts: 657
Trader Feedback: 0
Default

the snakmanv_3 doesn't wanna load for me. But that's pretty much what I need for now.

Edit: got it now. it's very nice, I think I'm gonna figure it out and start using it. Yes, i do know this uses more memory, but it's to protect files an such.

Last edited by Zettablade; 05-24-2006 at 08:46 PM..
Zettablade is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-24-2006, 08:56 PM   #10

Developer
 
Join Date: Nov 2005
Posts: 445
Trader Feedback: 0
Default

The gimp can do it too, will save any format to .c
A determined person can still edit your graphics with a hex editor however
danzel is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-24-2006, 09:04 PM   #11

...in a dream...
 
SG57's Avatar
 
Join Date: Jul 2005
Posts: 4,957
Trader Feedback: 0
Default

Yes, its quite easy to convert .C back to its image... But you have to hex edit the eboot and basically rip the 'image' out of it...
__________________
SG57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-24-2006, 09:17 PM   #12
 
framerate's Avatar
 
Join Date: Aug 2005
Location: Indiana
Posts: 389
Trader Feedback: 0
Default

this was very common for early PSP work (my first RPG engine used this technique). but now I really recommend just using libpng or SDL or something to load your images in.. it's way cleaner (in my opinion at least...)
__________________
[URL=http://www.framerate.info/psp][IMG]http://www.framerate.info/_hosted/imageupload/signature.gif[/IMG][/URL]
framerate is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-24-2006, 09:26 PM   #13

 
Zettablade's Avatar
 
Join Date: May 2006
Location: Programming or Farming Mudkips
Posts: 657
Trader Feedback: 0
Default

Hmm, the main downide to this is that .raw can't be transparent, and neither can bmp. Well, if anyone knows how to keep the transparency, let me know.
Zettablade is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-24-2006, 09:41 PM   #14
 
Yeldarb's Avatar
 
Join Date: Jul 2005
Posts: 984
Trader Feedback: 0
Default

You can't keep an alpha channel I don't think, but you can designate a color as transparent. (If you're writing your own blitting funtion that is; I'm not sure about how the different libraries handle transparency)
__________________
[url=http://www.barbdwyer.com/footer.php][img]http://www.barbdwyer.com/8Ball.jpg[/img][/url]
[FONT=Verdana][SIZE=1]
[b]PSP Developer Resource Site:[/b] [url=http://www.psp-programming.com]PSP-Programming.com[/url]

[b]Other:[/b] [url=http://wake-boarding.org]Wakeboarding[/url], [url=http://water-skiing.org]Waterskiing[/url], [url=http://wake-surfing.org]Wake Surfing[/url], [url=http://www.guitarhero-4.com]Guitar Hero IV[/url][/SIZE][/FONT]
Yeldarb is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-24-2006, 10:42 PM   #15

Developer
 
Join Date: Nov 2005
Posts: 445
Trader Feedback: 0
Default

PNG has transparency.
Check out libpng from the ps2dev svn and there is an example incliuded to show you how to use it.
danzel is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-25-2006, 04:23 AM   #16

 
Zettablade's Avatar
 
Join Date: May 2006
Location: Programming or Farming Mudkips
Posts: 657
Trader Feedback: 0
Default

Quote:
Originally Posted by danzel
PNG has transparency.
Check out libpng from the ps2dev svn and there is an example incliuded to show you how to use it.
yes, but this isn't png.

But yeldarb, that is an awsome idea. I think I'll look into it later after i get all my animations working.
Also, could you use a spritesheet after converting it to .c?
Zettablade is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-25-2006, 07:32 AM   #17
 
Yeldarb's Avatar
 
Join Date: Jul 2005
Posts: 984
Trader Feedback: 0
Default

I'm sure you could, you just have to write your own function to do it. Not too difficult.
__________________
[url=http://www.barbdwyer.com/footer.php][img]http://www.barbdwyer.com/8Ball.jpg[/img][/url]
[FONT=Verdana][SIZE=1]
[b]PSP Developer Resource Site:[/b] [url=http://www.psp-programming.com]PSP-Programming.com[/url]

[b]Other:[/b] [url=http://wake-boarding.org]Wakeboarding[/url], [url=http://water-skiing.org]Waterskiing[/url], [url=http://wake-surfing.org]Wake Surfing[/url], [url=http://www.guitarhero-4.com]Guitar Hero IV[/url][/SIZE][/FONT]
Yeldarb is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-25-2006, 07:40 AM   #18

total-Z
 
youresam's Avatar
 
Join Date: Jul 2005
Location: texas
Posts: 2,803
Trader Feedback: 0
Default

Quote:
Originally Posted by Zettablade
yes, but this isn't png.
Start -> All Programs -> Accessories -> Paint
File -> Open -> [open bmp]
File -> Save As... -> Save as type: PNG
__________________
牧来栠摩琠敨映汩獥
PSN: youresam
From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
youresam is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-25-2006, 07:44 AM   #19

 
Zettablade's Avatar
 
Join Date: May 2006
Location: Programming or Farming Mudkips
Posts: 657
Trader Feedback: 0
Default

Quote:
Originally Posted by youresam
Start -> All Programs -> Accessories -> Paint
File -> Open -> [open bmp]
File -> Save As... -> Save as type: PNG
lol
your funny. I'd never even open paint. Photoshop is far too good.
But in the end, even if it was a png, it would still be converted to a raw, and that would make the bg white. But as me an Yeldarb were just talking about, I'de have to make my own blitting function and designate a color to be transparent. very complicated stuffs.

Last edited by Zettablade; 05-25-2006 at 07:47 AM..
Zettablade is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-25-2006, 08:12 AM   #20

total-Z
 
youresam's Avatar
 
Join Date: Jul 2005
Location: texas
Posts: 2,803
Trader Feedback: 0
Default

Quote:
Originally Posted by Zettablade
lol
your funny. I'd never even open paint. Photoshop is far too good.
But in the end, even if it was a png, it would still be converted to a raw, and that would make the bg white. But as me an Yeldarb were just talking about, I'de have to make my own blitting function and designate a color to be transparent. very complicated stuffs.
Why do you want it to be a raw image??
Just use PNG, it has no color loss, and is highly compressed. AND supports transparentcy and you can easily handle it with libpng.
Yeldarb made a great image tutorial that uses libpng:
http://www.psp-programming.com/tutorials/c/lesson04.htm
__________________
牧来栠摩琠敨映汩獥
PSN: youresam
From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
youresam is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-25-2006, 08:36 AM   #21
 
Yeldarb's Avatar
 
Join Date: Jul 2005
Posts: 984
Trader Feedback: 0
Default

The whole thread is about how to convert an image to RAW and embed it into his program
__________________
[url=http://www.barbdwyer.com/footer.php][img]http://www.barbdwyer.com/8Ball.jpg[/img][/url]
[FONT=Verdana][SIZE=1]
[b]PSP Developer Resource Site:[/b] [url=http://www.psp-programming.com]PSP-Programming.com[/url]

[b]Other:[/b] [url=http://wake-boarding.org]Wakeboarding[/url], [url=http://water-skiing.org]Waterskiing[/url], [url=http://wake-surfing.org]Wake Surfing[/url], [url=http://www.guitarhero-4.com]Guitar Hero IV[/url][/SIZE][/FONT]
Yeldarb is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-25-2006, 08:41 AM   #22

 
Zettablade's Avatar
 
Join Date: May 2006
Location: Programming or Farming Mudkips
Posts: 657
Trader Feedback: 0
Default

have you read this topic? It's discussing converting images into a c file so you can encrypt the images within the EBOOT. png is awsome, but for an image to be converted into a c file, it must first be converted into a raw!
Edit - Yeldarb beat me to it.

Last edited by Zettablade; 05-25-2006 at 08:57 AM..
Zettablade is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-25-2006, 10:40 AM   #23

Muppet Magnet
 
Fanjita's Avatar
 
Join Date: Sep 2005
Location: Edinburgh, UK
Posts: 2,388
Trader Feedback: 0
Default

Actually you could still embed PNGs in your EBOOT, there's no need to decode them to raw bitmaps first. And that way, you'd take advantage of the extra file compression too.

The only downside is you have to do a bit of messing with custom read functions in libpng, which can be confusing for a lot of people, especially with a lack of good examples on the web. But it's not all that hard.
Fanjita is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-25-2006, 10:44 AM   #24

total-Z
 
youresam's Avatar
 
Join Date: Jul 2005
Location: texas
Posts: 2,803
Trader Feedback: 0
Default

Quote:
Originally Posted by Zettablade
have you read this topic? It's discussing converting images into a c file so you can encrypt the images within the EBOOT. png is awsome, but for an image to be converted into a c file, it must first be converted into a raw!
Edit - Yeldarb beat me to it.
I understand that, but I dont think he knows about how to use PNG. I mean, he is new, and probably doesnt know much. Using PNGs are a lot simpler to both implement the code and create the images, as well as transparencies.
__________________
牧来栠摩琠敨映汩獥
PSN: youresam
From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
youresam is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
converting , graphics

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 08:06 AM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us