kris
0560409717
Fix --lookahead parsing
2023-01-31 21:28:40 +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
kris
8b5c3dc6c1
Fix bool flags
2021-11-24 16:03:55 +00:00
kris
9a77af37aa
Add a --show-final-score to output the final image quality score.
...
This is useful when used as part of an image repository build
pipeline, to avoid replacing existing images if the new score is
higher.
Hide intermediate output behind --verbose
2021-11-24 15:49:56 +00:00
kris
0036ee9522
Add default values to help
2021-11-24 15:44:37 +00:00
kris
8d3ab4f50e
Add the ability to disable saving preview images. Also rename --gamma_correct to --gamma-correct for consistency
2021-11-24 15:41:32 +00:00
kris
8175dcb052
Add --fixed-colours to control how many colours will be kept identical
...
across all 16 SHR palettes.
2021-11-24 15:27:34 +00:00
kris
5fefd0b0bb
Don't initialize pygame if --no-show-output
2021-11-24 15:24:58 +00:00
kris
e77e7abd43
Rename
2021-11-24 15:24:45 +00:00
kris
d645cc5964
Tidy
2021-11-24 15:21:50 +00:00
kris
c36de2b76b
When initializing centroids for fitting the SHR palettes, only use the
...
reserved colours from the global palette, and pick unique random
points from the samples for the rest. This encourages a larger range
of colours in the resulting images and may improve quality.
Iterate a max number of times without improvement in the outer loop as
well.
Save intermediate preview outputs.
2021-11-24 14:57:24 +00:00
kris
3b8767782b
Each run seems to converge fairly quickly but there is a lot of variation across runs. Run in a loop and keep the running best.
2021-11-24 11:47:39 +00:00
kris
de8a303de2
Initial attempt at fitting palettes to arbitrary lines instead of line ranges.
...
Works OK but isn't converging as well as I hoped.
2021-11-24 10:41:25 +00:00
kris
50c71d3a35
Whitespace
2021-11-24 09:19:35 +00:00
kris
04fd4f7427
Move reassigning palettes back to after fitting, otherwise it does the
...
wrong thing the first time.
Fix an off by one when splitting palette ranges
2021-11-24 09:18:59 +00:00
kris
62f23ff910
Don't mutate initial_centroids
2021-11-24 09:10:03 +00:00
kris
7179d009e1
Refactor
...
Reassign palettes before computing new ones instead of after
2021-11-23 15:09:12 +00:00
kris
e488955c23
Reorder
2021-11-23 14:58:46 +00:00