Loading bitmap images in lejos nxj

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

Loading bitmap images in lejos nxj

Postby DrProton » Wed Mar 07, 2012 8:47 pm

Hello,

I try to open a PNG-Image, which I've uploaded onto the NXT, but get a file not found exception. The file is surely on the NXT.
In which format must tthe image file be and how do I display it on the screen with lejos?

Regards
DrProton
New User
 
Posts: 2
Joined: Wed Mar 07, 2012 5:41 pm

Re: Loading bitmap images in lejos nxj

Postby gloomyandy » Wed Mar 07, 2012 11:47 pm

How are you trying to load the image?

Images for use in leJOS on the NXT must be in the native leJOS format(.lni files) which is described here:
http://lejos.sourceforge.net/nxt/nxj/ap ... Image.html
Note that the doc in the create image method is slightly incorrect, there is a 4 byte file type signature at the start of the file, see the source code for the image class for details:
http://lejos.svn.sourceforge.net/viewvc ... iew=markup
There is a PC side program supplied with leJOS called nxjimage which will read standard image files (including .png files) and will convert them into the native format (including performing simple color to black and white conversion), or will allow the creation of code that can be placed in line to initialize an in memory image structure. For details of how to do this and for how to display images on the LCD see the sample application graphicssample...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3881
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Loading bitmap images in lejos nxj

Postby DrProton » Sun Mar 18, 2012 7:48 pm

Thanks, that helped me a lot!
I now use the code generated by nxjimage.

To load the image before, I tried to use file.open(...), but got a file not found exception, although the file is on the NXT.
DrProton
New User
 
Posts: 2
Joined: Wed Mar 07, 2012 5:41 pm


Return to NXJ Software

Who is online

Users browsing this forum: Baidu [Spider] and 3 guests

more stuff