[HN Gopher] Show HN: HiColor -- convert images to retro 15/16-bi...
___________________________________________________________________
Show HN: HiColor -- convert images to retro 15/16-bit RGB color
with dithering
Author : networked
Score : 55 points
Date : 2021-07-08 09:53 UTC (3 days ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| dmd wrote:
| What does "git style" mean for a CLI?
| bluedino wrote:
| Wasn't dithering only visible in Windows when using 256-color
| mode? Bonus for switching apps and having to wait that fraction
| of a second when the palette was swapped, so you'd possibly see
| the program you just alt-tabbed to in radically different colors.
| networked wrote:
| When I got the idea to write HiColor, I was thinking about the
| PlayStation's dithering the most.
|
| https://www.chrismcovell.com/psxdither.html
|
| I think Windows never applied whole-screen dithering on the
| desktop in 16-bit color mode. Some UI elements, applications,
| and games, however, did their own dithering. (Maybe in Direct3D
| and OpenGL it was up to the graphics card drivers? I am not
| sure. I couldn't confirm or refute this with a quick search.)
| As an example from Windows itself, I switched a Windows 2000 VM
| to high color, and the gradients in the window title bars
| became dithered.
|
| https://i.imgur.com/jrzdcNq.png (top is 32-bit color, bottom is
| 16-bit)
| akkartik wrote:
| By great coincidence, I've been working on dithering on my
| 256-color computer. So far I have greyscale:
| https://merveilles.town/@akkartik/106561555110196484
|
| I should have color in a few hours.
|
| Hello, fellow traveler! I'm using Floyd-Steinberg and don't
| depend on C (either directly or indirectly)
| networked wrote:
| Neat. Are you going to apply Floyd-Steinberg to moving images?
| It is good for still pictures, but I wouldn't use it for real-
| time graphics unless I was deliberately going for a "jittery"
| effect. Consider a spatially stable dither like Bayer's or
| https://pippin.gimp.org/a_dither/ instead.
| akkartik wrote:
| Good to know! I hadn't thought that far. This is a pretty
| low-power computer, so video hasn't been a priority.. I think
| I'm going to shoot to render internet in a box corpuses.
| Wikipedia, Gutenberg, stuff like that.
| kazinator wrote:
| Ordered dithering may match what Windows does in 16 bit mode, to
| recreate that look, but you can't call it "period appropriate",
| given that Floyd-Steinberg was published in 1976, well before the
| first line of Windows was written (and just three years after
| Bayer).
| networked wrote:
| I call ordered dithering "period-appropriate" because it is
| what software and hardware implemented at the time for real-
| time dithering. I don't mean to imply other dithering
| algorithms hadn't been invented. Did any other reader interpret
| it like that?
|
| Edit: Rather than wait for replies, I went ahead and changed
| the phrasing anyway. Thanks!
| naikrovek wrote:
| no, no one else read it like that.
|
| more than one thing can be period-appropriate.
| dmbaggett wrote:
| Curious: is the significant palette shift purely a byproduct of
| the limited bits per color? Or is that somehow baked into the
| high color format? For example the anime image gets much bluer
| than I would have expected. Is that a tunable parameter or just
| how well you can possibly do within the constraints of the
| format?
| raphlinus wrote:
| You can absolutely make hi-color images which are close to
| visually indistinguishable from the 24 bit originals, by using
| a good dither matrix. GdkRgb did this well over 20 years ago,
| back when "CRT" meant a display technology, and the fuzziness
| made the dither patterns melt.
|
| If you were doing it _really_ carefully, you 'd use a
| corrective gamma function, as dithering in a nonlinear
| colorspace is not an identity transfer function. Alternatively,
| you can do error diffusion in a linear space. But at 5 bits,
| the effect is fairly subtle.
| dmbaggett wrote:
| Thanks -- that accords with my intuition but your detailed
| explanation is excellent.
| retrac wrote:
| Even 256 colours at high DPI can look pretty good with an
| intelligent dither.
| networked wrote:
| The palette shift is an artifact of the current dithering
| (quantization) algorithm [1]. It becomes visible when you apply
| quantization a few times to the same image. (50 in the example.
| I've updated the image and replaced the "After" label with "Gen
| 50" to make this more obvious.) It won't be too visible to the
| human eye after a single quantization pass.
|
| Edit: The result of a single pass for the anime image looks
| like this: https://i.imgur.com/dTmzRwF.png. I've changed
| "visible" to "too visible" above, because the image _is_
| visibly a little brighter.
|
| [1]
| https://github.com/dbohdan/hicolor/blob/f00eac41417b0e989e1e...
| allanrbo wrote:
| "It works at least on Linux and Windows 98 Second Edition, 2000
| Service Pack 4, XP, and 7." Wonder if author actually tested on
| Win98SE in 2021 :-)
| networked wrote:
| I did test it! I had no VM with Windows 98 SE already
| installed, so instead I used someone's "Windows 98 Live CD"
| from the Internet Archive. I integrated hicolor.exe and some
| test pictures into the ISO with ISO Master and booted qemu-
| system-i386 from it. The program passed manual testing. I
| realized I could automate the ISO mastering with a shell script
| and the actual testing with a BAT file to create a Windows 9x
| approximation of fresh-VM CI without messing with HDD
| snapshots, but (somehow!) decided not to. I don't think I will
| be integrating Windows 98 SE or Windows 2000 into the CI
| pipeline, so support for either may break.
| allanrbo wrote:
| Awesome. Feeling nostalgia now :-D
| dylan604 wrote:
| Can you do this in a VM?
| vessel wrote:
| Yes, but the author is most likely using a Win API that is
| known to exist since that operating system & service pack. I
| doubt they tested every version, unless they are the curious
| type :)
| huachimingo wrote:
| Install mtpaint (or gimp).
|
| ->Converted to indexed (or modify palette), select amount of
| bits. -> select palette algorithm and dithering (mtpaint has
| option for small palettes) -> save
___________________________________________________________________
(page generated 2021-07-11 23:01 UTC)