APNG文件没有任何明确的方法来检测它们。对于APNg unawware应用程序,它们显示为普通PNG,并且将显示第一个屏幕。检测它们有点麻烦。
发布于 2020-06-14 08:37:56
APNG可以通过查看数据在IDAT块之前是否包含acTL块来检测。
此解决方案根据以下响应改编为python:https://stackoverflow.com/a/4525194/5997749
def is_apng(a: bytes):
acTL = a.find(b"\x61\x63\x54\x4C")
if acTL > 0: # find returns -1 if it cant find anything
iDAT = a.find(b"\x49\x44\x41\x54")
if acTL < iDAT:
return True
return Falsehttps://stackoverflow.com/questions/62367134
复制相似问题