![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
[
](https://github.com/K0lb3/etcpak/actions?query=workflow Build & Publish wheels)
A python wrapper for wolfpld/etcpak All relevant function and class documentation was taken from wolfpld/etcpak.
pip install etcpak
or download/clone the git and use
python setup.py install
from PIL import Image
import etcpak
# load image
img = Image.open(file_path)
# get image data
img_data = img.convert("RGBA").tobytes()
# compress data
compressed = etcpak.compress_bc3(img_data, img.width, img.height)
composite image for format comparission
import os
import etcpak
import texture2ddecoder
from PIL import Image
FORMATS = [
("DXT1", etcpak.compress_bc1, texture2ddecoder.decode_bc1),
("DXT1 Dither", etcpak.compress_bc1_dither, texture2ddecoder.decode_bc1),
("DXT5", etcpak.compress_bc3, texture2ddecoder.decode_bc3),
("ETC1", etcpak.compress_etc1_rgb, texture2ddecoder.decode_etc1),
("ETC1 Dither", etcpak.compress_etc1_rgb_dither, texture2ddecoder.decode_etc1),
("ETC2 RGB", etcpak.compress_etc2_rgb, texture2ddecoder.decode_etc2),
("ETC2 RGBA", etcpak.compress_etc2_rgba, texture2ddecoder.decode_etc2a8)
]
p = "S:\\Pictures"
for fp in os.listdir(p):
if not fp[-4:] in [".png", ".jpg", ".bmp", "jpeg"]:
continue
# load image and adjust format and size
print(fp)
img = Image.open(os.path.join(p, fp)).convert("RGBA")
img = img.crop((0,0,img.width-img.width%4, img.height-img.height%4))
# create composite image
comp = Image.new("RGBA", (img.width*8, img.height))
comp.paste(img, (0, 0))
print(img.width * img.height * 4)
# iterate over all formats
for i, (name, enc, dec) in enumerate(FORMATS):
print(name)
# make sure that the channel order is correct for the compression
if name[:3] == "DXT":
raw = img.tobytes()
elif name[:3] == "ETC":
r,g,b,a = img.split()
raw = Image.merge('RGBA', (b,g,r,a)).tobytes()
# compress
data = enc(raw, img.width, img.height)
# decompress
dimg = Image.frombytes("RGBA", img.size, dec(data, img.width, img.height), "raw", "BGRA")
# add to composite image
comp.paste(dimg, (img.width*(i+1), 0))
# save composite image
comp.save(os.path.splitext(fp)[0]+".png")
see etcpak/init.pyi
FAQs
python wrapper for etcpak
We found that etcpak demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.