Thursday, April 1, 2021

auto-contrast

I'm still toiling on the Atari 2600 graphics editor (with import) I mentioned the other day - the splash-o-matic One small bug (or at least poor UX) was that a dark imported image might come in as all black pixels, and so look like the process had failed. So besides adding a "loading" bit of text, I made a heuristic that tried 5 different contrast levels and then picked the one that had the closest to even split of black and white pixels. Works pretty well, and now an image is at least discernable, even if the user will still probably want to play with the contrast slider some more.

Now that I think about, maybe a better algorithm would have been to see what contrast settings had the most detail... maybe by counting "how many pixels are touching a pixel of a different color". Hmmm.

No comments:

Post a Comment