Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
Hello everyone! The latest tool for converting images for use on the TI84+CE/TI83PCE calculators is here! ConvPNG can be used in many ways to output either the assembly or C header file for use in your programs. Many options are available, simply read the provided readme for more information. Enjoy! Smile

This will hopefully be useful with some of the upcoming C library routines Wink

You can find the download here: Download

Update v1.1 is here! It fixes a few bugs with palette conversion, and some output things. Enjoy! Smile

Download link: https://github.com/MateoConLechuga/ConvPNG/releases
What distance metric do you use for palette conversion?
elfprince13 wrote:
What distance metric do you use for palette conversion?

Um, none.
How do you handle it then? Do you just assume all the colors are already present in the palette?
elfprince13 wrote:
How do you handle it then? Do you just assume all the colors are already present in the palette?

Yes. There's a few bugs with the options in convpng right now; specifically the -i with multiple inputs, and -g. I don't really know how to check the distance, but would greatly appreciate it if someone were to make this tool a lot more useful Smile
So the naive/straightforward thing to do is find the palette color p which minimizes √((r_s-r_p)^2+(g_s-g_p)^2+(b_s-b_p)^2) for source color s. But you probably want to read over https://en.wikipedia.org/wiki/Color_quantization to get a good idea of the different options for generating and mapping to palettes.
Being honest I personally use the standard mapping approach (nearest colour) in my personal tools. However I typically convert any graphics to whatever palette I'm using in an image editor prior to processing to image data.

At some stage down the line other techniques would be useful if this is to become a mainstream utility.
tr1p1ea wrote:
Being honest I personally use the standard mapping approach (nearest colour) in my personal tools. However I typically convert any graphics to whatever palette I'm using in an image editor prior to processing to image data.

That seems really useful. I would really like to just be able to send it a whole bunch of image files, it determines the best palette based on all of the images, and then returns the palette along with the converted images. I feel like this would be the optimal solution, but I don't really know how to compute the best color through differences yet Smile
You could probably just run k-means on the concatenation of all of the pixels from the images.
ConvPNG Link: Download

ConvPNG has just gotten a massive update, which will be extremely useful for C and ASM programmers alike. It can now take groups of images, determine the best palette for each group, and then convert each image using the palette. It also allows reserving a certain color for transparency, so you can have transparent sprites. Rather than being just a command-line tool, it now is more of a hybrid and uses 'convpng.ini' in the images directory in order to easily be able to group and convert images. A sample one with 2 palettes (or groups) may look like this:


Code:
#GroupC            : gfx_group_1
#Compression       : none                 (Compression type: none, rle, lz77)
#TranspColor       : 255,255,255,255      (Transparent color: r,g,b,a - a will most always be 255)
#Sprites           :                      (List of sprites for this group to convert)
 image0
 image1
 image2

#GroupC            : gfx_group_2
#Compression       : lz77                 (Compression type: none, rle, lz77)
#Sprites           :                      (List of sprites for this group to convert)
 image3
 image4
 image5
 image6


It also supports rle and lz77 compression of images, in order to help reduce size. Huffman was considered, but doesn't really perform well for palette-driven images. Color conversion is also a lot closer thanks to help from Runer. Overall, I hope that you all will find this quite useful Smile

Let me know if you need any help working with it; or if you have and suggestions/comments. Enjoy! Very Happy

For the technically inclined, it uses a combination of mediancut and K-means in order to choose the best palette for the groups of images.
So here's something:

How can I use this to create a sprite using the default palette? I think I could figure out how to embed it in the program, but getting it to the correct format is something I haven't looked into.

If possible, could this be done using linux and wine?

Thanks in advance!
There's simply no point in using the default palette if you are creating sprites. And it will work fine with wine. It's already included in the toolchain setup too, so you can run it anywhere Wink
Have you thought about adding a feature that splits larger pictures into indivisual tiles? Sort of like the PicConvert -t option. Also, I think having an option for making custom fonts would also be helpful. Smile
Hi, have you considered gif format as well please - i was hoping to add gif viewing to prizm. Thanks
ConvPNG has been updated! Now you can specify custom palettes to quantize against, or use one of the built in xlibc or rgb332 palettes. This means you can specify a palette, and then the image(s) will be converted to match the palette as close as possible.

https://github.com/MateoConLechuga/ConvPNG/releases/tag/v3.0

Zaalane wrote:
Have you thought about adding a feature that splits larger pictures into indivisual tiles? Sort of like the PicConvert -t option. Also, I think having an option for making custom fonts would also be helpful. Smile

Yep, I like this idea. I'll see if I can add it to the next release Smile
Yup, this can prove useful. tttiler, part of the TI-68k Developer Utilities ( https://github.com/debrouxl/gcc4ti/blob/next/trunk/tigcc/tools/tttiler.c ) , provides such tiling functionality, for monochrome and 4 grayscale images.
There seems to be a problem with it now... I just updated the SKD and convpng, and I followed the exact same format I did for another prgram that worked, and when making the file, I get this error:

Code:
 (108,37) :   ERROR (128) Identifier "gfx_sprite_t" not defined within current scope


It appears that <groupCName>.h calls it, but doesn't declare it? Not sure if I'm doing something wrong, it used to work...
Unicorn wrote:
There seems to be a problem with it now... I just updated the SKD and convpng, and I followed the exact same format I did for another prgram that worked, and when making the file, I get this error:

Code:
 (108,37) :   ERROR (128) Identifier "gfx_sprite_t" not defined within current scope


It appears that <groupCName>.h calls it, but doesn't declare it? Not sure if I'm doing something wrong, it used to work...

The problem (And I imagine this has something to do with your post in the SDK topic) is that you updated ConvPNG for the toolchain. You don't want to do this Razz ConvPNG will be added to the toolchain once it is confirmed to work properly with the new graphics library setup (later this week); as for now this update was just to resolve some assembly creation issues. Smile
Ok, so can you link to the release I should use? Not sure which one...
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 3
» All times are GMT - 5 Hours
 
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

 

Advertisement