Skip to content

Commit fc27cfc

Browse files
Merge pull request #371 from tannerhelland/neuquant
This merge adds a new neural-network color quantizer to PhotoDemon. (A color quantizer builds a palette of [n] colors from an existing image.) I started with [Neuquant](https://en.wikipedia.org/wiki/Color_quantization#Algorithms), a well-known color quantizer, and reworked the algorithm extensively to better fit PD's unique use-cases and performance requirements. This included overhauling the algorithm to also work with alpha channels. The end result is a fast, powerful quantizer than can produce remarkably high-quality 8-bit (<=256 color) images, which is particularly relevant for things like exporting animated GIFs. I'm currently investigating adding animated WebP support to the project, which is part of what prompted this work on a new, better quantizer. One of the unique strengths of Neuquant is how well it can produce palettes for images with subtle gradients, like logos, charts, or 3D-rendered objects/scenes. This makes it especially useful for optimizing images for the web, because Neuquant can produce 8-bit versions of images that look very close to their 32-bit counterparts, but unlike other mechanisms that rely on dithering to "artificially" make color density look richer, Neuquant simply generates a much better palette. This lets you get away with undithered 8-bit reduction for most images, which greatly improves compressibility of the final image (compared to the "noise" dithering naturally introduces). Anyway, the main use-cases of this new feature are hidden, with PD silently leaning on the new color quantizer when relevant (like saving to 8-bit formats a la GIF). To play with the quantizer as a standalone feature, you can use the Effects > Stylize > Palettize tool, which directly exposes the quantizer for experimentation.
2 parents 4e015a6 + 1512bb5 commit fc27cfc

30 files changed

Lines changed: 1127 additions & 646 deletions

App/PhotoDemon/Languages/French.xml

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<langid>fr-FR</langid>
88
<langname>Français</langname>
9-
<langversion>6.7.544</langversion>
9+
<langversion>6.7.545</langversion>
1010
<langstatus>Complete</langstatus>
1111

1212
<author>Jean Jacques Piedfort (orig. Frank Donckers)</author>
@@ -2703,7 +2703,7 @@ Pour activer le support du scanner, veuillez copiez le fichier EZTW32.dll (dispo
27032703
<translation>license zLib</translation>
27042704
</phrase>
27052705

2706-
<!-- Plugin_Management.bas contains 22 phrases. 16 were duplicates of existing phrases, so only 6 new phrases were written to file. -->
2706+
<!-- Plugin_Management.bas contains 24 phrases. 18 were duplicates of existing phrases, so only 6 new phrases were written to file. -->
27072707

27082708
<phrase>
27092709
<original>Preparing image for printing</original>
@@ -6252,6 +6252,23 @@ La mise à jour est traitée automatiquement en arrière-plan. Vous recevrez une
62526252

62536253
<!-- Adjustments_Levels.frm contains 13 phrases. 7 were duplicates of existing phrases, so only 6 new phrases were written to file. -->
62546254

6255+
<phrase>
6256+
<original>foreground</original>
6257+
<translation></translation>
6258+
</phrase>
6259+
6260+
<phrase>
6261+
<original>gamma</original>
6262+
<translation>gamma</translation>
6263+
</phrase>
6264+
6265+
<phrase>
6266+
<original>Removing haze from image</original>
6267+
<translation></translation>
6268+
</phrase>
6269+
6270+
<!-- Adjustments_Lighting_Dehaze.frm contains 7 phrases. 4 were duplicates of existing phrases, so only 3 new phrases were written to file. -->
6271+
62556272
<phrase>
62566273
<original>exposure compensation (stops)</original>
62576274
<translation>compensation d'exposition (arrêts)</translation>
@@ -6262,11 +6279,6 @@ La mise à jour est traitée automatiquement en arrière-plan. Vous recevrez une
62626279
<translation>décalage</translation>
62636280
</phrase>
62646281

6265-
<phrase>
6266-
<original>gamma</original>
6267-
<translation>gamma</translation>
6268-
</phrase>
6269-
62706282
<phrase>
62716283
<original>new exposure curve</original>
62726284
<translation>nouvelle courbe d'exposition</translation>
@@ -6277,7 +6289,7 @@ La mise à jour est traitée automatiquement en arrière-plan. Vous recevrez une
62776289
<translation>Réglage de l'exposition de l'image</translation>
62786290
</phrase>
62796291

6280-
<!-- Adjustments_Lighting_Exposure.frm contains 7 phrases. 2 were duplicates of existing phrases, so only 5 new phrases were written to file. -->
6292+
<!-- Adjustments_Lighting_Exposure.frm contains 7 phrases. 3 were duplicates of existing phrases, so only 4 new phrases were written to file. -->
62816293

62826294
<phrase>
62836295
<original>keep all colors in sync</original>
@@ -8943,13 +8955,8 @@ If you want to save it with a different file name, please select 'Cancel', then
89438955
</phrase>
89448956

89458957
<phrase>
8946-
<original>Xiaolin Wu</original>
8947-
<translation>Xiaolin Wu</translation>
8948-
</phrase>
8949-
8950-
<phrase>
8951-
<original>NeuQuant</original>
8952-
<translation>NeuQuant</translation>
8958+
<original>neural network</original>
8959+
<translation></translation>
89538960
</phrase>
89548961

89558962
<phrase>
@@ -8982,7 +8989,7 @@ If you want to save it with a different file name, please select 'Cancel', then
89828989
<translation>ATTENTION ! Fichier de palette invalide.</translation>
89838990
</phrase>
89848991

8985-
<!-- Effects_Stylize_Palettize.frm contains 33 phrases. 15 were duplicates of existing phrases, so only 18 new phrases were written to file. -->
8992+
<!-- Effects_Stylize_Palettize.frm contains 31 phrases. 14 were duplicates of existing phrases, so only 17 new phrases were written to file. -->
89868993

89878994
<phrase>
89888995
<original>glow radius</original>
@@ -13656,24 +13663,12 @@ Si vous choisissez de désactiver les mises à jour, n'oubliez pas de visiter ph
1365613663

1365713664
<!-- Tools_ScreenVideoPrefs.frm contains 17 phrases. 7 were duplicates of existing phrases, so only 10 new phrases were written to file. -->
1365813665

13659-
<phrase>
13660-
<original>foreground</original>
13661-
<translation></translation>
13662-
</phrase>
13663-
13664-
<phrase>
13665-
<original>Removing haze from image</original>
13666-
<translation></translation>
13667-
</phrase>
13668-
13669-
<!-- Adjustments_Lighting_Dehaze.frm contains 7 phrases. 5 were duplicates of existing phrases, so only 2 new phrases were written to file. -->
13670-
1367113666
<!-- Automatic text extraction complete. -->
1367213667

13673-
<phrasecount>2584</phrasecount>
13668+
<phrasecount>2583</phrasecount>
1367413669

1367513670
<!-- As of this build, PhotoDemon contains 5324 phrases. -->
13676-
<!-- 2740 are duplicates, so only 2584 unique phrases have been written to file. -->
13677-
<!-- These 2584 phrases contain approximately 11871 total words. -->
13671+
<!-- 2741 are duplicates, so only 2583 unique phrases have been written to file. -->
13672+
<!-- These 2583 phrases contain approximately 11870 total words. -->
1367813673

1367913674
</pdData>

App/PhotoDemon/Languages/German.xml

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<langid>de-DE</langid>
88
<langname>Deutsch (DE)</langname>
9-
<langversion>9.0.724</langversion>
9+
<langversion>9.0.725</langversion>
1010
<langstatus>Up-to-date</langstatus>
1111

1212
<author>rk (ehem. Frank Donckers, Helmut Kuerbiss)</author>
@@ -2702,7 +2702,7 @@ Um die Scanner-Unterstützung zu aktivieren, kopieren Sie bitte die Datei EZTW32
27022702
<translation>zLib-License</translation>
27032703
</phrase>
27042704

2705-
<!-- Plugin_Management.bas contains 22 phrases. 16 were duplicates of existing phrases, so only 6 new phrases were written to file. -->
2705+
<!-- Plugin_Management.bas contains 24 phrases. 18 were duplicates of existing phrases, so only 6 new phrases were written to file. -->
27062706

27072707
<phrase>
27082708
<original>Preparing image for printing</original>
@@ -6254,6 +6254,23 @@ Das Update wird automatisch im Hintergrund verarbeitet. Sie werden ein neue Bena
62546254

62556255
<!-- Adjustments_Levels.frm contains 13 phrases. 7 were duplicates of existing phrases, so only 6 new phrases were written to file. -->
62566256

6257+
<phrase>
6258+
<original>foreground</original>
6259+
<translation>Vordergrund</translation>
6260+
</phrase>
6261+
6262+
<phrase>
6263+
<original>gamma</original>
6264+
<translation>Gamma</translation>
6265+
</phrase>
6266+
6267+
<phrase>
6268+
<original>Removing haze from image</original>
6269+
<translation>Entfernung des Dunstes aus Bild</translation>
6270+
</phrase>
6271+
6272+
<!-- Adjustments_Lighting_Dehaze.frm contains 7 phrases. 4 were duplicates of existing phrases, so only 3 new phrases were written to file. -->
6273+
62576274
<phrase>
62586275
<original>exposure compensation (stops)</original>
62596276
<translation>Belichtungskompensation (Stopps)</translation>
@@ -6264,11 +6281,6 @@ Das Update wird automatisch im Hintergrund verarbeitet. Sie werden ein neue Bena
62646281
<translation>Offset</translation>
62656282
</phrase>
62666283

6267-
<phrase>
6268-
<original>gamma</original>
6269-
<translation>Gamma</translation>
6270-
</phrase>
6271-
62726284
<phrase>
62736285
<original>new exposure curve</original>
62746286
<translation>Neue Belichtungskurve</translation>
@@ -6279,7 +6291,7 @@ Das Update wird automatisch im Hintergrund verarbeitet. Sie werden ein neue Bena
62796291
<translation>Bildbelichtung wird angepasst</translation>
62806292
</phrase>
62816293

6282-
<!-- Adjustments_Lighting_Exposure.frm contains 7 phrases. 2 were duplicates of existing phrases, so only 5 new phrases were written to file. -->
6294+
<!-- Adjustments_Lighting_Exposure.frm contains 7 phrases. 3 were duplicates of existing phrases, so only 4 new phrases were written to file. -->
62836295

62846296
<phrase>
62856297
<original>keep all colors in sync</original>
@@ -8945,13 +8957,8 @@ If you want to save it with a different file name, please select 'Cancel', then
89458957
</phrase>
89468958

89478959
<phrase>
8948-
<original>Xiaolin Wu</original>
8949-
<translation>Xiaolin Wu</translation>
8950-
</phrase>
8951-
8952-
<phrase>
8953-
<original>NeuQuant</original>
8954-
<translation>NeuQuant</translation>
8960+
<original>neural network</original>
8961+
<translation></translation>
89558962
</phrase>
89568963

89578964
<phrase>
@@ -8984,7 +8991,7 @@ If you want to save it with a different file name, please select 'Cancel', then
89848991
<translation>WARNUNG! Palettendatei ungültig.</translation>
89858992
</phrase>
89868993

8987-
<!-- Effects_Stylize_Palettize.frm contains 33 phrases. 15 were duplicates of existing phrases, so only 18 new phrases were written to file. -->
8994+
<!-- Effects_Stylize_Palettize.frm contains 31 phrases. 14 were duplicates of existing phrases, so only 17 new phrases were written to file. -->
89888995

89898996
<phrase>
89908997
<original>glow radius</original>
@@ -13641,24 +13648,12 @@ Wenn Sie sich dennoch dafür entscheiden, Updates zu deaktivieren, vergessen Sie
1364113648

1364213649
<!-- Tools_ScreenVideoPrefs.frm contains 17 phrases. 7 were duplicates of existing phrases, so only 10 new phrases were written to file. -->
1364313650

13644-
<phrase>
13645-
<original>foreground</original>
13646-
<translation>Vordergrund</translation>
13647-
</phrase>
13648-
13649-
<phrase>
13650-
<original>Removing haze from image</original>
13651-
<translation>Entfernung des Dunstes aus Bild</translation>
13652-
</phrase>
13653-
13654-
<!-- Adjustments_Lighting_Dehaze.frm contains 7 phrases. 5 were duplicates of existing phrases, so only 2 new phrases were written to file. -->
13655-
1365613651
<!-- Automatic text extraction complete. -->
1365713652

13658-
<phrasecount>2584</phrasecount>
13653+
<phrasecount>2583</phrasecount>
1365913654

1366013655
<!-- As of this build, PhotoDemon contains 5324 phrases. -->
13661-
<!-- 2740 are duplicates, so only 2584 unique phrases have been written to file. -->
13662-
<!-- These 2584 phrases contain approximately 11871 total words. -->
13656+
<!-- 2741 are duplicates, so only 2583 unique phrases have been written to file. -->
13657+
<!-- These 2583 phrases contain approximately 11870 total words. -->
1366313658

1366413659
</pdData>

App/PhotoDemon/Languages/Indonesian.xml

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<langid>id-ID</langid>
88
<langname>Indonesian</langname>
9-
<langversion>6.6.502</langversion>
9+
<langversion>6.6.503</langversion>
1010
<langstatus>Complete</langstatus>
1111

1212
<author>Ari Sohandri Putra (7.0 updates by Google Translate)</author>
@@ -2705,7 +2705,7 @@ Untuk mengaktifkan dukungan scanner, silahkan salin file EZTW32.dll (tersedia un
27052705
<translation>lesen zlib</translation>
27062706
</phrase>
27072707

2708-
<!-- Plugin_Management.bas contains 22 phrases. 16 were duplicates of existing phrases, so only 6 new phrases were written to file. -->
2708+
<!-- Plugin_Management.bas contains 24 phrases. 18 were duplicates of existing phrases, so only 6 new phrases were written to file. -->
27092709

27102710
<phrase>
27112711
<original>Preparing image for printing</original>
@@ -6252,6 +6252,23 @@ Pembaruan otomatis pengolahan di latar belakang. Anda akan menerima pemberitahua
62526252

62536253
<!-- Adjustments_Levels.frm contains 13 phrases. 7 were duplicates of existing phrases, so only 6 new phrases were written to file. -->
62546254

6255+
<phrase>
6256+
<original>foreground</original>
6257+
<translation></translation>
6258+
</phrase>
6259+
6260+
<phrase>
6261+
<original>gamma</original>
6262+
<translation>gamma</translation>
6263+
</phrase>
6264+
6265+
<phrase>
6266+
<original>Removing haze from image</original>
6267+
<translation></translation>
6268+
</phrase>
6269+
6270+
<!-- Adjustments_Lighting_Dehaze.frm contains 7 phrases. 4 were duplicates of existing phrases, so only 3 new phrases were written to file. -->
6271+
62556272
<phrase>
62566273
<original>exposure compensation (stops)</original>
62576274
<translation>pampasan pendedahan (berhenti)</translation>
@@ -6262,11 +6279,6 @@ Pembaruan otomatis pengolahan di latar belakang. Anda akan menerima pemberitahua
62626279
<translation>mengimbangi</translation>
62636280
</phrase>
62646281

6265-
<phrase>
6266-
<original>gamma</original>
6267-
<translation>gamma</translation>
6268-
</phrase>
6269-
62706282
<phrase>
62716283
<original>new exposure curve</original>
62726284
<translation>keluk pendedahan baru</translation>
@@ -6277,7 +6289,7 @@ Pembaruan otomatis pengolahan di latar belakang. Anda akan menerima pemberitahua
62776289
<translation>Melaraskan pendedahan imej</translation>
62786290
</phrase>
62796291

6280-
<!-- Adjustments_Lighting_Exposure.frm contains 7 phrases. 2 were duplicates of existing phrases, so only 5 new phrases were written to file. -->
6292+
<!-- Adjustments_Lighting_Exposure.frm contains 7 phrases. 3 were duplicates of existing phrases, so only 4 new phrases were written to file. -->
62816293

62826294
<phrase>
62836295
<original>keep all colors in sync</original>
@@ -8943,13 +8955,8 @@ If anda mahu menyimpannya dengan nama fail yang berbeza, sila pilih 'Batal', kem
89438955
</phrase>
89448956

89458957
<phrase>
8946-
<original>Xiaolin Wu</original>
8947-
<translation>Xiaolin Wu</translation>
8948-
</phrase>
8949-
8950-
<phrase>
8951-
<original>NeuQuant</original>
8952-
<translation>NeuQuant</translation>
8958+
<original>neural network</original>
8959+
<translation></translation>
89538960
</phrase>
89548961

89558962
<phrase>
@@ -8982,7 +8989,7 @@ If anda mahu menyimpannya dengan nama fail yang berbeza, sila pilih 'Batal', kem
89828989
<translation></translation>
89838990
</phrase>
89848991

8985-
<!-- Effects_Stylize_Palettize.frm contains 33 phrases. 15 were duplicates of existing phrases, so only 18 new phrases were written to file. -->
8992+
<!-- Effects_Stylize_Palettize.frm contains 31 phrases. 14 were duplicates of existing phrases, so only 17 new phrases were written to file. -->
89868993

89878994
<phrase>
89888995
<original>glow radius</original>
@@ -13641,24 +13648,12 @@ Jika anda masih memilih untuk melumpuhkan Perbarui, jangan lupa untuk mengunjung
1364113648

1364213649
<!-- Tools_ScreenVideoPrefs.frm contains 17 phrases. 7 were duplicates of existing phrases, so only 10 new phrases were written to file. -->
1364313650

13644-
<phrase>
13645-
<original>foreground</original>
13646-
<translation></translation>
13647-
</phrase>
13648-
13649-
<phrase>
13650-
<original>Removing haze from image</original>
13651-
<translation></translation>
13652-
</phrase>
13653-
13654-
<!-- Adjustments_Lighting_Dehaze.frm contains 7 phrases. 5 were duplicates of existing phrases, so only 2 new phrases were written to file. -->
13655-
1365613651
<!-- Automatic text extraction complete. -->
1365713652

13658-
<phrasecount>2584</phrasecount>
13653+
<phrasecount>2583</phrasecount>
1365913654

1366013655
<!-- As of this build, PhotoDemon contains 5324 phrases. -->
13661-
<!-- 2740 are duplicates, so only 2584 unique phrases have been written to file. -->
13662-
<!-- These 2584 phrases contain approximately 11871 total words. -->
13656+
<!-- 2741 are duplicates, so only 2583 unique phrases have been written to file. -->
13657+
<!-- These 2583 phrases contain approximately 11870 total words. -->
1366313658

1366413659
</pdData>

0 commit comments

Comments
 (0)