Author Topic: TI.IMAGE help  (Read 5925 times)

0 Members and 2 Guests are viewing this topic.

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
TI.IMAGE help
« on: July 26, 2011, 09:12:08 pm »
I had an idea for a utility for Nspire programmers, but to make it, i need to understand the image format.
So my question is this: if you have the location and colors of all the pixels in a picture, how do you convert it to a TI.IMAGE?
Thanks :)
« Last Edit: July 26, 2011, 09:12:46 pm by pianoman »

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: TI.IMAGE help
« Reply #1 on: July 27, 2011, 12:41:26 am »
Ti.image is kinda complex.Check out this page I wrote: http://wiki.inspired-lua.org/TI.Image .
Also, I can give you some python/javascript code to create Ti.images If you want :)

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: TI.IMAGE help
« Reply #2 on: July 27, 2011, 11:44:03 am »
( which is right here : http://bwns.be/jim/sprite.html , thanks to our great jimbauwens :) )
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: TI.IMAGE help
« Reply #3 on: July 27, 2011, 11:55:25 am »
Whoops, didn't notice the page :P
Holy cow, that's complicated.
How exactly does the pixel data work, though? Shouldn't each of the R,G, and B values be 8-bit numbers? Why are they 5-bit?
In other words, why doesn't it work A-RRRRRRRR-GGGGGGGG-BBBBBBBB instead of A-RRRRR-GGGGG-BBBBB?
If it isn't 8 bit, then you can't make numbers bigger than 31.
« Last Edit: July 27, 2011, 01:09:29 pm by pianoman »

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: TI.IMAGE help
« Reply #4 on: July 27, 2011, 11:59:14 am »
Well you can always checkout jimbauwen's javascript/python's source code, it's very enlightening...

And btw, the official documentation might help you .... (the wiki is more detailed but may be harder to understand) - the official .doc documentation is much lighter about TI.Image....
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: TI.IMAGE help
« Reply #5 on: July 27, 2011, 12:50:53 pm »
pianoman, the R / G / B data is 5 bits because TI defined so :)
The CX's screen is used in 16-bit mode.
A1R5G5B5 is a fairly commonly used format. The link port screenshot command contains data in R5G6B5 format, AFAICS.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: TI.IMAGE help
« Reply #6 on: July 27, 2011, 01:09:44 pm »
Oh, I think I get it.
Thanks!

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: TI.IMAGE help
« Reply #7 on: July 27, 2011, 03:27:21 pm »
I see that you figured it out :)
Well, have fun with it!

Offline devpolytechnic

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
Re: TI.IMAGE help
« Reply #8 on: September 23, 2011, 07:54:55 am »
@pianoman
There's a scripting tool that's out there made by TI to help you convert images to TI.Images. The TI-Nspire Scripting Tool (http://education.ti.com/calculators/downloads/US/Software/Detail?id=6840) can help you convert your .lua files into copyable form, and you can copy that into a blank document on the TI-Nspire Student/Teacher Software, or you can use it to help you convert images into text form.

Convert a .lua file by clicking File -> Load Script App. This prompts a new window for the .lua location. Once you have selected so, click Enter and it will say at the bottom "yadayadayada...something has been placed on clipboard.". Go to your Nspire software, make a new document, but don't make a Calculator, Notes, etc. Instead, just click outside of it, and there's your blank document that says "Press Menu". Ctrl+V (Paste) it, and voila, whatever you wanted to convert into a .lua file should be inside it. (Although if you are trying to make a .tns, use Luna 2.0)

WARNING: This may cause some lag. Converting an image file you found from the internet to at least a million characters + may cause lots of lag.
Convert an image into text by clicking File -> Load Image. This prompts a new window, select the image, and hit Enter. It should also say at the bottom "...Something has been placed on your clipboard." Paste this into a text document (no OCLua, unfortunately, the calculator will say there are too many chars, and I don't think you want to copy one million numbers and slashes).

imageName = image.new("yadayadayadayadaimagetextcode") -- You probably know this anyway

I hope this helps!
i like programming :)
#include <iostream>
int main()
{
cout << "Hello, World!" << endl;
}

public class HelloWorld{
 public static void main(String[] args){
  System.out.println("Hello, World!");
 }
}

Define helloworld()=
Prgm
Disp "Hello, World!"
EndPrgm

function on.paint(gc)
 gc:drawString("Hello, World!",125,100)
end