Poki-imconvert - another image converter for pokitto

Hello all,

I have made a simple command line image converter for Pokitto which focuses on simplicity, integration and flexibility (unix style).

Features

  • convert automatically .png and .jpg to c++ header file.
  • exported pixels formats: rgb565, 8bits indexes, 4bits indexes, 2bits indexes.
  • export palette along image data.

How to use

It works as command line with: poki-imconvert [options] [image_file]
Where options are:

  • nopal: don’t export the palette.
  • format: force the export to a specified format. Possible values are:
    • f16: 16bits color (rgb565) per pixel.
    • fpal: 256 colors palette (8bits) index per pixel.

If format is not specified as an option, the exported format is automatically deduced from image format:

  • 32bits is exported as rgb565.
  • indexed with more than 16 color is exported as 8bits index per pixel.
  • indexed with less or equal than 16 colors is exported as 4bits index per pixel.
  • indexed with less or equel than 4 colors is exported as 2bits index per pixel.

Useful links

Why command line ?

Some may know, I did an UI based image converter for Arduboy, so why not one for Pokitto?
Because the hardware of Pokitto is not the same (it can output rgb565, has a better screen resolution) and there are TONS of very good softwares which can do pixel art, palette management, etc.
Moreover there is already BMP2POK, so it’s more like an alternative.

As a command line executable, it can be integrated as plugin, run as batch/script file, etc.

That’s all folks

Feedback is welcome!

2 Likes

Can’t get at the repo, it sends me to the sign-in screen.

Of course, I checked everything, but not that the repo is public …
It’s fixed, thanks !

1 Like

why you using sdl?

i also made a image converter way back

SDL and SDL image was the easiest, simpliest (a few small dlls), and best cross platform choice to handle correctly image loading with palette management.
Like your application, I first thought of using stb, but then I realized it doesn’t load palette + image but does directly the conversion.
I’ve could done with core Qt also, but too much dlls dependencies were in the way for just a simple command line application.

1 Like

The code is interesting.
Good to see C++11 features being used.
Also interesting to see const being used ‘the right way round’ (I admit I tend to do it the ‘wrong way round’).

1 Like

Thanks!

It’s a big fight for me, I have seen many “freshly out of the school” c++ beginners completely lost (including me in my first years) about const or not even using it because of this rule exception weirdness.

I even made a blog post about it:
https://zeduckmaster.frama.io/2017/dont-fear-the-constness/

3 Likes