Open mcorner opened 8 years ago
An ETC decoder needs to be added to Pillow for this.
Python and Unity are both completely new to me, but perhaps you could bundle a decoder:
http://pillow.readthedocs.io/en/latest/handbook/writing-your-own-file-decoder.html
using this tool: http://malideveloper.arm.com/resources/tools/mali-gpu-texture-compression-tool/
and this gist: https://gist.github.com/yin8086/6ce83c5d8e4cf1ac9879
as reference?
Thanks. ill take a look.
Edit: Uh, that's no good. It's subprocessing the texture to a separate executable...
Drat, I didn't catch that.
Hi !
And what about that : https://github.com/hglm/texgenpack ?
It is C code but maybe something is possible ?
There is a python library supporting unpacking ETC (and other) images if you are open to using another besides Pillow. Specifically, tex2img. Though I saw in PR #52 that someone may be trying to add Pillow support.
In any case, here's some code using it to unpack ETC and ETC2 images that unityextract doesn't support if anyone finds it useful. I modified unityextract to save as a pickle the image when the format was unsupported first.
# Line 134 of unityextract
try:
image = d.image
except NotImplementedError as e:
print("WARNING: Texture format not implemented. Skipping %r." % (filename),e)
print('\tWriting Data Directly')
python_data = pickle.dumps(d._obj)
self.write_to_file(d.name + ".pickle", python_data, mode="wb")
continue
The decompression code: