apftool 1.2.2__tar.gz → 1.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apftool
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Encoder and decoder for Aperture Science Image Format (apf), Aperture Science Image Format 2 (apf2), Wireless Bitmap (wbmp), Over-The-Air Bitmap (otb), and FaceDev's .bruh format
5
5
  Author: Mari (kbity)
6
6
  Requires-Python: >=3.10
@@ -101,6 +101,8 @@ apftool provides many extensions tuples:
101
101
 
102
102
  ## changelog:
103
103
 
104
+ 1.2.3 - add +1 bias for near-truecolor modes, reducing the darkening problem
105
+
104
106
  1.2.2 - add support for squeeze, improve handling for numpy/scipy not being installed. Signifigant performance improvement for Truecolor modes.
105
107
 
106
108
  1.2.1 - add support for 3 of apf2's compressed modes [bzip2, gzip, ascii packing]
@@ -89,6 +89,8 @@ apftool provides many extensions tuples:
89
89
 
90
90
  ## changelog:
91
91
 
92
+ 1.2.3 - add +1 bias for near-truecolor modes, reducing the darkening problem
93
+
92
94
  1.2.2 - add support for squeeze, improve handling for numpy/scipy not being installed. Signifigant performance improvement for Truecolor modes.
93
95
 
94
96
  1.2.1 - add support for 3 of apf2's compressed modes [bzip2, gzip, ascii packing]
@@ -14,7 +14,7 @@ extensions_mqif = (".mqif", ".mqi")
14
14
 
15
15
  extensions_txt = (".txt", ".text") # txt is seen as a generic container for apf/apf2 because they're just txt files
16
16
 
17
- version = "1.2.2"
17
+ version = "1.2.3"
18
18
 
19
19
  extensions_all = []
20
20
  extensions_all.extend(extensions_apf+extensions_apf2+extensions_capf2+extensions_wbmp+extensions_otb+extensions_bruh+extensions_mqif)
@@ -32,7 +32,7 @@ def quant_to_base95(g: int):
32
32
  return round(g/X)
33
33
 
34
34
  mapping = []
35
- for i in range(256):
35
+ for i in range(257): # +1 to cover bias +1
36
36
  mapping.append(chr(quant_to_base95(i)+32))
37
37
  mapping_invert = {}
38
38
  for i, c in enumerate(mapping):
@@ -791,8 +791,8 @@ def generate_runs_apf2_l(bitmap: list, lineskip: int, w: int, h: int, topside_fi
791
791
  runlens.append(runcounter)
792
792
  return runlens
793
793
 
794
- def uint8_to_base95_with_corrector(val):
795
- d = mapping[val]
794
+ def uint8_to_base95_with_corrector(val, bias = 0):
795
+ d = mapping[val+bias]
796
796
  c = mapping_invert[d]
797
797
  e = val - c
798
798
  return d, e
@@ -849,6 +849,7 @@ def generate_runs_apf2_f(bitmap: list, lineskip: int, w: int, h: int, trans, com
849
849
  perfect = False
850
850
  alpha = False
851
851
  fakealpha = False
852
+ bias = 1
852
853
 
853
854
  if mode in (7, 8):
854
855
  gray = True
@@ -857,6 +858,7 @@ def generate_runs_apf2_f(bitmap: list, lineskip: int, w: int, h: int, trans, com
857
858
 
858
859
  if mode in (5, 6):
859
860
  perfect = True
861
+ bias = 0
860
862
 
861
863
  if mode in (4, 6):
862
864
  alpha = True
@@ -919,13 +921,13 @@ def generate_runs_apf2_f(bitmap: list, lineskip: int, w: int, h: int, trans, com
919
921
  if combine and pixel == (0,0,0,0) and not isTransPix:
920
922
  pixel = (255,0,255,0) # alpha is zero but the RGB is non-zero
921
923
 
922
- r, rc = uint8_to_base95_with_corrector(pixel[0])
923
- g, gc = uint8_to_base95_with_corrector(pixel[1])
924
- b, bc = uint8_to_base95_with_corrector(pixel[2])
924
+ r, rc = uint8_to_base95_with_corrector(pixel[0], bias)
925
+ g, gc = uint8_to_base95_with_corrector(pixel[1], bias)
926
+ b, bc = uint8_to_base95_with_corrector(pixel[2], bias)
925
927
  a, ac = "~", 0
926
928
 
927
929
  if alpha:
928
- a, ac = uint8_to_base95_with_corrector(pixel[3])
930
+ a, ac = uint8_to_base95_with_corrector(pixel[3], bias)
929
931
 
930
932
  # tri-level alpha for free
931
933
  elif fakealpha and perfect:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apftool
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Encoder and decoder for Aperture Science Image Format (apf), Aperture Science Image Format 2 (apf2), Wireless Bitmap (wbmp), Over-The-Air Bitmap (otb), and FaceDev's .bruh format
5
5
  Author: Mari (kbity)
6
6
  Requires-Python: >=3.10
@@ -101,6 +101,8 @@ apftool provides many extensions tuples:
101
101
 
102
102
  ## changelog:
103
103
 
104
+ 1.2.3 - add +1 bias for near-truecolor modes, reducing the darkening problem
105
+
104
106
  1.2.2 - add support for squeeze, improve handling for numpy/scipy not being installed. Signifigant performance improvement for Truecolor modes.
105
107
 
106
108
  1.2.1 - add support for 3 of apf2's compressed modes [bzip2, gzip, ascii packing]
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "apftool"
7
- version = "1.2.2"
7
+ version = "1.2.3"
8
8
  description = "Encoder and decoder for Aperture Science Image Format (apf), Aperture Science Image Format 2 (apf2), Wireless Bitmap (wbmp), Over-The-Air Bitmap (otb), and FaceDev's .bruh format"
9
9
  authors = [{name = "Mari (kbity)"}]
10
10
  readme = "README.md"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes