ifstools 3.0__tar.gz → 3.1__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.
- {ifstools-3.0 → ifstools-3.1}/PKG-INFO +1 -4
- {ifstools-3.0 → ifstools-3.1}/README.md +0 -3
- {ifstools-3.0 → ifstools-3.1}/pyproject.toml +1 -1
- {ifstools-3.0 → ifstools-3.1}/src/ifstools/handlers/image_decoders.py +14 -8
- {ifstools-3.0 → ifstools-3.1}/.github/workflows/maturin.yml +0 -0
- {ifstools-3.0 → ifstools-3.1}/.gitignore +0 -0
- {ifstools-3.0 → ifstools-3.1}/Cargo.lock +0 -0
- {ifstools-3.0 → ifstools-3.1}/Cargo.toml +0 -0
- {ifstools-3.0 → ifstools-3.1}/LICENSE +0 -0
- {ifstools-3.0 → ifstools-3.1}/ifstools_bin.py +0 -0
- {ifstools-3.0 → ifstools-3.1}/rust/dxt.rs +0 -0
- {ifstools-3.0 → ifstools-3.1}/rust/lib.rs +0 -0
- {ifstools-3.0 → ifstools-3.1}/rust/lz77.rs +0 -0
- {ifstools-3.0 → ifstools-3.1}/rust/png_enc.rs +0 -0
- {ifstools-3.0 → ifstools-3.1}/src/ifstools/__init__.py +0 -0
- {ifstools-3.0 → ifstools-3.1}/src/ifstools/handlers/_lz77_py.py +0 -0
- {ifstools-3.0 → ifstools-3.1}/src/ifstools/handlers/afp_folder.py +0 -0
- {ifstools-3.0 → ifstools-3.1}/src/ifstools/handlers/generic_file.py +0 -0
- {ifstools-3.0 → ifstools-3.1}/src/ifstools/handlers/generic_folder.py +0 -0
- {ifstools-3.0 → ifstools-3.1}/src/ifstools/handlers/image_file.py +0 -0
- {ifstools-3.0 → ifstools-3.1}/src/ifstools/handlers/lz77.py +0 -0
- {ifstools-3.0 → ifstools-3.1}/src/ifstools/handlers/md5_folder.py +0 -0
- {ifstools-3.0 → ifstools-3.1}/src/ifstools/handlers/node.py +0 -0
- {ifstools-3.0 → ifstools-3.1}/src/ifstools/handlers/tex_folder.py +0 -0
- {ifstools-3.0 → ifstools-3.1}/src/ifstools/ifs.py +0 -0
- {ifstools-3.0 → ifstools-3.1}/src/ifstools/ifstools.py +0 -0
- {ifstools-3.0 → ifstools-3.1}/src/ifstools/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ifstools
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.1
|
|
4
4
|
Requires-Dist: kbinxml>=1.5
|
|
5
5
|
Requires-Dist: lxml
|
|
6
6
|
Requires-Dist: pillow
|
|
@@ -93,9 +93,6 @@ uv pip install . pyinstaller==6.19.0
|
|
|
93
93
|
uv run pyinstaller --onefile --name ifstools ifstools_bin.py
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
Notes:
|
|
97
|
-
- argb8888rev and dxt5 can be repacked. Other formats will silently be converted to argb8888rev
|
|
98
|
-
|
|
99
96
|
Todo:
|
|
100
97
|
- Recursive repacking for ifs inside ifs
|
|
101
98
|
|
|
@@ -79,9 +79,6 @@ uv pip install . pyinstaller==6.19.0
|
|
|
79
79
|
uv run pyinstaller --onefile --name ifstools ifstools_bin.py
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
Notes:
|
|
83
|
-
- argb8888rev and dxt5 can be repacked. Other formats will silently be converted to argb8888rev
|
|
84
|
-
|
|
85
82
|
Todo:
|
|
86
83
|
- Recursive repacking for ifs inside ifs
|
|
87
84
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from io import BytesIO
|
|
2
2
|
|
|
3
|
-
from PIL import Image
|
|
3
|
+
from PIL import Image, ImageChops
|
|
4
4
|
from tqdm import tqdm
|
|
5
5
|
|
|
6
6
|
try:
|
|
@@ -44,11 +44,11 @@ def decode_argb4444(ifs_img, data):
|
|
|
44
44
|
return Image.merge('RGBA', (b, g, r, a))
|
|
45
45
|
|
|
46
46
|
def encode_argb4444(ifs_img, image):
|
|
47
|
-
#
|
|
48
|
-
r, g, b, a = image.split()
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return
|
|
47
|
+
# PIL has no packer for RGBA;4B. Per pixel: byte0 = G<<4|B, byte1 = A<<4|R
|
|
48
|
+
r, g, b, a = image.convert('RGBA').split()
|
|
49
|
+
lo = ImageChops.add(g.point(lambda v: v & 0xF0), b.point(lambda v: v >> 4))
|
|
50
|
+
hi = ImageChops.add(a.point(lambda v: v & 0xF0), r.point(lambda v: v >> 4))
|
|
51
|
+
return Image.merge('LA', (lo, hi)).tobytes()
|
|
52
52
|
|
|
53
53
|
def decode_dxt(ifs_img, data, version):
|
|
54
54
|
rgba = _native.decode_dxt(data, ifs_img.img_size[0], ifs_img.img_size[1], version)
|
|
@@ -60,14 +60,20 @@ def decode_dxt5(ifs_img, data):
|
|
|
60
60
|
def decode_dxt1(ifs_img, data):
|
|
61
61
|
return decode_dxt(ifs_img, data, 'dxt1')
|
|
62
62
|
|
|
63
|
+
def encode_dxt(ifs_img, image, version):
|
|
64
|
+
return _native.encode_dxt(image.tobytes('raw', 'RGBA'), image.width, image.height, version)
|
|
65
|
+
|
|
63
66
|
def encode_dxt5(ifs_img, image):
|
|
64
|
-
return
|
|
67
|
+
return encode_dxt(ifs_img, image, 'dxt5')
|
|
68
|
+
|
|
69
|
+
def encode_dxt1(ifs_img, image):
|
|
70
|
+
return encode_dxt(ifs_img, image, 'dxt1')
|
|
65
71
|
|
|
66
72
|
|
|
67
73
|
image_formats = {
|
|
68
74
|
'argb8888rev' : {'decoder': decode_argb8888rev, 'encoder': encode_argb8888rev},
|
|
69
75
|
'argb4444' : {'decoder': decode_argb4444, 'encoder': encode_argb4444},
|
|
70
|
-
'dxt1' : {'decoder': decode_dxt1, 'encoder': None},
|
|
76
|
+
'dxt1' : {'decoder': decode_dxt1, 'encoder': encode_dxt1 if _native else None},
|
|
71
77
|
'dxt5' : {'decoder': decode_dxt5, 'encoder': encode_dxt5 if _native else None},
|
|
72
78
|
}
|
|
73
79
|
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|