Ardu-imconvert - A desktop image converter for Arduboy


#41

Can you add more information?

  • which format you use from ardu-imconvert
  • which function you use to draw the image with which version of arduboy library

As far as I understood, it is just a warning, but the application is working, isn’t it?
Is it possible to have a peek to the code you wrote also?

thanks


(Erwin) #42

The image data but wrapped as code ready to use as a .h file. It is pretty sweet :stuck_out_tongue:

I am using drawCompressed, but it seems your template is right, trying the same code in my other PC does not display any warnings. So I am guessing it is an old arduboy2 library or something. I will check this later in the original PC.


(Pharap) #43

I think normally it would be an error, but because the Arduino IDE always uses the -fpermissive flag, it only shows up as a warning.

The gcc docs outright admit that it makes certain non-conforming C++ compile.

-fpermissive
Downgrade some diagnostics about nonconformant code from errors to warnings. Thus, using -fpermissive will allow some nonconforming code to compile.

A simple cast will resolve the issue, but I haven’t seen enough code to identify where the cast should be or if it should be a static_cast or a reinterpret_cast.

In that case yes, it could be ardu-imconvert’s doing.


#44

Thanks for making this, it’s very useful!

I have an issue with converting some images though. The images display wrongly and I realised the conversion is not correct. If I convert the image by hand it differs, but the conversion by hand displays correctly on the Arduboy.

An example is this:

  • correct conversion (by hand): 0x10, 0x08, 0x1e, 0x3c, 0x7e, 0x8, 0x10, 0x0
  • incorrect conversion (ardu-imconvert): 0x10, 0x08, 0x9e, 0x3d, 0x7f, 0x09, 0x10, 0x40

The PNG: PNG

I’m using Arduboy2.drawBitmap() to display sprites. Am I doing something wrong?


#45

First thanks a lot.

Your png is an index based png which contains 3 used colors: a pure black (0,0,0), a pure white (255, 255, 255) and an almost black one (2, 2, 2). The error comes from that.
In ardu-imconvert i’m using pure black(0,0,0) for the black and white for all the rest.
Try to replace these pixels (2,2,2) by pure black and it should work.

P.S.: Although I don’t want to add any image processing to the software (there are tons of softwares which will do better to anything that I could add), I will try to think about a way to be able to spot these kind of errors.


#46

That fixed it, thanks a lot!

I’ve seen some converters using a higher threshold for black, but it’s true that it’s better to spot these kinds of problems early and correct them in the PNG instead. Maybe something like displaying a warning that the image is using middle values, not just pure black and white.


(Pharap) #47

I have an image converter that I’ve written but haven’t published,
and based on my experiments with it I find that the best approach is:

var shade = (r + g +b) / 3;
return (shade > 127)  ? White : Black;

An example:

3513_1 -> threshold

And for the sake of trying something more interesting:


(I also considered converting to HSV and using the V component,
but HSV is fiddly so I couldn’t be bothered.)


#48

That could be, but I prefer to stick with the pure black for black, because this kind of conversion can make hard to predict the result (and you’re more free in a real image manipulation program).
But the real problem behind this (either wrong pixel values or better b&w conversion) is a lack of preview of the converted data in the software.
So…

v0.9

Changes

  • Added preview feature

Downloads

P.S.: I can’t make macOS version anymore (don’t have access to hardware and mac virtual machine are now a pain or impossible to setup), so if anybody wants to make a prebuilt .dmg, I can help on this.


(Erwin) #49

I think you changed something else in the new Windows version

(not using modern style in controls?)

and… I think the next version is going to need a threshold input :stuck_out_tongue: for the conversion


#50

Yes I changed the compiler to mingw and the qt version. Maybe I forgot a plugin for deployment.
Which version of windows are you using?

For the threshold, I think I will pass on that because it requires to decide about a specific conversion algorithm (which the threshold will affect) which may fit some but not others, etc.
If I have to do something, then I will directly let the user the possibility to customize him/herself the conversion function (maybe with some lua?).


(Erwin) #51

Windows 10, and I think it is probably a skin thing. Because even if I add the manifest to use the modern controls, it does not do anything.

image


#52

It should be fixed now (it was a style plugin missing):

https://framagit.org/zeduckmaster/ardu-imconvert/uploads/02efeea56e8fd8e706daa0cbe3818912/ardu-imconvert-0.9.7z


(Erwin) #53

Yes, it is perfect now. Thanks!