apftool 1.2.2__tar.gz → 1.2.4__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.
- {apftool-1.2.2 → apftool-1.2.4}/PKG-INFO +5 -1
- {apftool-1.2.2 → apftool-1.2.4}/README.md +4 -0
- {apftool-1.2.2 → apftool-1.2.4}/apftool/__init__.py +1 -1
- {apftool-1.2.2 → apftool-1.2.4}/apftool/apf2.py +12 -9
- {apftool-1.2.2 → apftool-1.2.4}/apftool.egg-info/PKG-INFO +5 -1
- {apftool-1.2.2 → apftool-1.2.4}/pyproject.toml +1 -1
- {apftool-1.2.2 → apftool-1.2.4}/LICENSE +0 -0
- {apftool-1.2.2 → apftool-1.2.4}/apftool/apf.py +0 -0
- {apftool-1.2.2 → apftool-1.2.4}/apftool/apf2quant.py +0 -0
- {apftool-1.2.2 → apftool-1.2.4}/apftool/apfcli.py +0 -0
- {apftool-1.2.2 → apftool-1.2.4}/apftool/asciipak.py +0 -0
- {apftool-1.2.2 → apftool-1.2.4}/apftool/bittools.py +0 -0
- {apftool-1.2.2 → apftool-1.2.4}/apftool/bruh.py +0 -0
- {apftool-1.2.2 → apftool-1.2.4}/apftool/mqif.py +0 -0
- {apftool-1.2.2 → apftool-1.2.4}/apftool/otb.py +0 -0
- {apftool-1.2.2 → apftool-1.2.4}/apftool/scqoi.py +0 -0
- {apftool-1.2.2 → apftool-1.2.4}/apftool/wbmp.py +0 -0
- {apftool-1.2.2 → apftool-1.2.4}/apftool.egg-info/SOURCES.txt +0 -0
- {apftool-1.2.2 → apftool-1.2.4}/apftool.egg-info/dependency_links.txt +0 -0
- {apftool-1.2.2 → apftool-1.2.4}/apftool.egg-info/entry_points.txt +0 -0
- {apftool-1.2.2 → apftool-1.2.4}/apftool.egg-info/requires.txt +0 -0
- {apftool-1.2.2 → apftool-1.2.4}/apftool.egg-info/top_level.txt +0 -0
- {apftool-1.2.2 → apftool-1.2.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apftool
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.4
|
|
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,10 @@ apftool provides many extensions tuples:
|
|
|
101
101
|
|
|
102
102
|
## changelog:
|
|
103
103
|
|
|
104
|
+
1.2.4 - spec conformance [I swear I will release it soon], +1 bias for 95-level grayscale
|
|
105
|
+
|
|
106
|
+
1.2.3 - add +1 bias for near-truecolor modes, reducing the darkening problem
|
|
107
|
+
|
|
104
108
|
1.2.2 - add support for squeeze, improve handling for numpy/scipy not being installed. Signifigant performance improvement for Truecolor modes.
|
|
105
109
|
|
|
106
110
|
1.2.1 - add support for 3 of apf2's compressed modes [bzip2, gzip, ascii packing]
|
|
@@ -89,6 +89,10 @@ apftool provides many extensions tuples:
|
|
|
89
89
|
|
|
90
90
|
## changelog:
|
|
91
91
|
|
|
92
|
+
1.2.4 - spec conformance [I swear I will release it soon], +1 bias for 95-level grayscale
|
|
93
|
+
|
|
94
|
+
1.2.3 - add +1 bias for near-truecolor modes, reducing the darkening problem
|
|
95
|
+
|
|
92
96
|
1.2.2 - add support for squeeze, improve handling for numpy/scipy not being installed. Signifigant performance improvement for Truecolor modes.
|
|
93
97
|
|
|
94
98
|
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.
|
|
17
|
+
version = "1.2.4"
|
|
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(
|
|
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):
|
|
@@ -339,6 +339,7 @@ def graypal(perfect: bool = False):
|
|
|
339
339
|
for n in set(mapping):
|
|
340
340
|
if not n in pal:
|
|
341
341
|
pal[n] = (mapping_invert[n], mapping_invert[n], mapping_invert[n])
|
|
342
|
+
pal["~"] = (255, 255, 255)
|
|
342
343
|
return pal
|
|
343
344
|
|
|
344
345
|
def int_alpha_composit(l1: tuple, l2: tuple):
|
|
@@ -543,7 +544,7 @@ def decode(apf2: str | bytes, format: str = 'PNG', returnImageObject: bool = Fal
|
|
|
543
544
|
if mode == 0:
|
|
544
545
|
pals = apf_lines[2].split(".")
|
|
545
546
|
if pals[0] == "":
|
|
546
|
-
if transparency_mode:
|
|
547
|
+
if transparency_mode == 1:
|
|
547
548
|
pals[0] = (0,0,0,0)
|
|
548
549
|
else:
|
|
549
550
|
pals[0] = (0,0,0)
|
|
@@ -791,8 +792,8 @@ def generate_runs_apf2_l(bitmap: list, lineskip: int, w: int, h: int, topside_fi
|
|
|
791
792
|
runlens.append(runcounter)
|
|
792
793
|
return runlens
|
|
793
794
|
|
|
794
|
-
def uint8_to_base95_with_corrector(val):
|
|
795
|
-
d = mapping[val]
|
|
795
|
+
def uint8_to_base95_with_corrector(val, bias = 0):
|
|
796
|
+
d = mapping[val+bias]
|
|
796
797
|
c = mapping_invert[d]
|
|
797
798
|
e = val - c
|
|
798
799
|
return d, e
|
|
@@ -849,6 +850,7 @@ def generate_runs_apf2_f(bitmap: list, lineskip: int, w: int, h: int, trans, com
|
|
|
849
850
|
perfect = False
|
|
850
851
|
alpha = False
|
|
851
852
|
fakealpha = False
|
|
853
|
+
bias = 1
|
|
852
854
|
|
|
853
855
|
if mode in (7, 8):
|
|
854
856
|
gray = True
|
|
@@ -857,6 +859,7 @@ def generate_runs_apf2_f(bitmap: list, lineskip: int, w: int, h: int, trans, com
|
|
|
857
859
|
|
|
858
860
|
if mode in (5, 6):
|
|
859
861
|
perfect = True
|
|
862
|
+
bias = 0
|
|
860
863
|
|
|
861
864
|
if mode in (4, 6):
|
|
862
865
|
alpha = True
|
|
@@ -912,20 +915,20 @@ def generate_runs_apf2_f(bitmap: list, lineskip: int, w: int, h: int, trans, com
|
|
|
912
915
|
ind = chr(i1+32)+chr(i0+32)
|
|
913
916
|
curpixval = ind
|
|
914
917
|
else:
|
|
915
|
-
v, _ = uint8_to_base95_with_corrector(pixtup)
|
|
918
|
+
v, _ = uint8_to_base95_with_corrector(pixtup+1) # +1 bias
|
|
916
919
|
curpixval = v
|
|
917
920
|
|
|
918
921
|
else:
|
|
919
922
|
if combine and pixel == (0,0,0,0) and not isTransPix:
|
|
920
923
|
pixel = (255,0,255,0) # alpha is zero but the RGB is non-zero
|
|
921
924
|
|
|
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])
|
|
925
|
+
r, rc = uint8_to_base95_with_corrector(pixel[0], bias)
|
|
926
|
+
g, gc = uint8_to_base95_with_corrector(pixel[1], bias)
|
|
927
|
+
b, bc = uint8_to_base95_with_corrector(pixel[2], bias)
|
|
925
928
|
a, ac = "~", 0
|
|
926
929
|
|
|
927
930
|
if alpha:
|
|
928
|
-
a, ac = uint8_to_base95_with_corrector(pixel[3])
|
|
931
|
+
a, ac = uint8_to_base95_with_corrector(pixel[3], bias)
|
|
929
932
|
|
|
930
933
|
# tri-level alpha for free
|
|
931
934
|
elif fakealpha and perfect:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apftool
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.4
|
|
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,10 @@ apftool provides many extensions tuples:
|
|
|
101
101
|
|
|
102
102
|
## changelog:
|
|
103
103
|
|
|
104
|
+
1.2.4 - spec conformance [I swear I will release it soon], +1 bias for 95-level grayscale
|
|
105
|
+
|
|
106
|
+
1.2.3 - add +1 bias for near-truecolor modes, reducing the darkening problem
|
|
107
|
+
|
|
104
108
|
1.2.2 - add support for squeeze, improve handling for numpy/scipy not being installed. Signifigant performance improvement for Truecolor modes.
|
|
105
109
|
|
|
106
110
|
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.
|
|
7
|
+
version = "1.2.4"
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|