Commit Graph

246 Commits

Author SHA1 Message Date
kris
5d6cbfc438 Tweak 2023-02-03 00:29:59 +00:00
kris
4f8fe0c1e8 Fix breakage in refactoring 2023-02-03 00:29:19 +00:00
kris
a3433fd632 Document hi-res and add some examples 2023-02-03 00:28:54 +00:00
kris
153c104f94 Rename class and add comments 2023-02-03 00:04:32 +00:00
kris
cb9228e46d Add comments 2023-02-02 23:55:08 +00:00
kris
b0aa38fe06 Unify DHR and HGR implementation in screen.py 2023-02-02 23:53:48 +00:00
kris
f019823505 Clean up hgr conversion optionns 2023-02-02 23:35:28 +00:00
kris
36946f6ac7 Unify DHR and HGR image conversion 2023-02-02 23:18:03 +00:00
kris
d47defbd80 Prepare to unify with dither_dhr.pyx 2023-02-02 23:14:29 +00:00
kris
762a21556a Clean up 2023-02-02 22:29:24 +00:00
kris
db4449ea26 Working version 2023-02-02 22:17:56 +00:00
kris
154a0b7c29 WIP - HGR support 2023-01-31 21:34:29 +00:00
kris
1b08a8f1b1 Whitespace 2023-01-31 21:34:29 +00:00
KrisKennaway
6573bad509
Merge pull request #10 from KrisKennaway/fix-lookahead
Fix --lookahead parsing
2023-01-31 21:32:02 +00:00
kris
0560409717 Fix --lookahead parsing 2023-01-31 21:28:40 +00:00
KrisKennaway
055851aa9c
Merge pull request #9 from KrisKennaway/create-data-dir
Create data directory before writing to it
2023-01-31 21:15:03 +00:00
kris
2ab582790c Create data directory before writing to it 2023-01-31 21:12:42 +00:00
KrisKennaway
05a3624866
Merge pull request #5 from KrisKennaway/mono
Add support for DHGR mono conversions and fix compatibility with python 3.10
2023-01-21 17:32:14 +00:00
kris
39e8eac8ed Add support for DHGR mono conversions 2023-01-21 17:30:27 +00:00
kris
629104b933 Fixes for python 3.10 and/or latest dependency versions 2023-01-21 17:29:06 +00:00
kris
7b8b6bc12b Tweak 2022-07-19 22:41:38 +01:00
kris
7ce574dc06 Add SHR details 2022-07-19 22:39:56 +01:00
kris
2a1874face Tweak wording 2022-07-19 22:39:11 +01:00
kris
c61bd258fd Add sample SHR conversions 2022-07-19 22:38:59 +01:00
kris
b11b322c39 Move DHR examples to subdir in preparation for adding SHR examples 2022-07-18 23:11:23 +01:00
KrisKennaway
bce2153d97
Merge pull request #4 from KrisKennaway/shr
Add support for Super Hi-Res conversions
2022-07-18 23:06:18 +01:00
kris
1468e06d2f Tweak 2022-07-18 23:02:49 +01:00
kris
1486f8a394 Add TODO 2022-07-18 22:31:22 +01:00
kris
12d6805617 Update docs for 2.0 and split out the technical details of dhr into its own file 2022-07-18 22:30:56 +01:00
kris
e156dd3b48 Add a requirements.txt to simplify installation 2022-07-18 22:11:32 +01:00
kris
3196369b7d Tidy a bit and add a --save-intermediate flag 2022-07-18 10:00:19 +01:00
kris
1ffb2c9110 Tidy 2022-07-18 09:59:01 +01:00
kris
8fd0ec5dc6 Set window title and clean up a bit 2022-07-16 22:13:26 +01:00
kris
e71352490d Add comments 2022-07-16 22:00:42 +01:00
kris
99aa394196 Tweak comment 2022-07-16 22:00:14 +01:00
kris
cfef9fa3c9 Add arg type 2022-07-16 21:57:45 +01:00
kris
ccbb6980d9 Load data files relative to script path 2021-11-27 10:43:41 +00:00
kris
a2b67ba882 Require a subcommand 2021-11-26 13:36:29 +00:00
kris
4d5dea2c41 Restore dhr conversion support 2021-11-26 13:15:57 +00:00
kris
0a964b377a Move SHR conversion out into convert_shr in preparation for re-enabling dhr support 2021-11-26 12:35:45 +00:00
kris
ae89682dab Split out common utility functions into a shared module 2021-11-26 12:26:46 +00:00
kris
0dc2c0a7a0 Disable bounds checking and wraparound by default 2021-11-26 12:12:55 +00:00
kris
4221c00701 Split dither into dither_dhr and dither_shr 2021-11-26 12:08:48 +00:00
kris
1075ff0136 Tidy a bit and remove support for tunable parameters that are no longer needed 2021-11-26 10:36:39 +00:00
kris
cf63a35797 Cython tweaks to remove some unnecessary C code 2021-11-26 09:54:42 +00:00
kris
25e6ed7b88 Preserve palette order when deduplicating entries
Also make sure we're not mutating _global_palettes, though this should
currently be harmless.
2021-11-25 21:57:27 +00:00
kris
61b4cbb184 Tweak k-means convergence criterion to return once the total centroid position error stops decreasing. 2021-11-25 21:33:12 +00:00
kris
fc35387360 - Fill any palettes that have fewer than 16 unique entries after
clustering, using the most frequent pixel colours that are not yet
  in the palette

- Reassign any palettes that are duplicated after clustering
2021-11-25 13:14:22 +00:00
kris
ad50ed103d Improvements to image quality:
- Preprocess the source image by dithering with the full 12-bit //gs
  colour palette, ignoring SHR palette restrictions (i.e. each pixel
  chosen independently from 4096 colours)

- Using this as the ground truth allows much better handling of
  e.g. solid colours, which were being dithered inconsistently with
  the previous approach

- Also when fitting an SHR palette, fix any colours that comprise more
  than 10% of source pixels.  This also encourages more uniformity in
  regions of solid colour.
2021-11-25 11:46:42 +00:00
kris
870c008827 Parametrize quantization error decay and minimum value. The latter
helps with images where there are large solid colour fields that
sometimes cause uneven dithering because of colours that cannot be
matched with the //gs palette, but it's not a viable solution in
general since it reduces overall quality (sometimes substantially,
e.g. in case of vertical colour gradients)
2021-11-25 09:09:40 +00:00