如何从加密图像中获取二维码?
How can I get a QR code from an encrypted image?
用Notepad++打开后发现这是一个二维码
如果 python 有解决此问题的任何库,如何恢复它?
我不会说这是加密的,更像是编码方式,每个白色像素都应该是数字字符,而其他字符应该显示为黑色。 解码 相当容易,然后您可以使用您最喜欢的图像 building/manipulation 库重新创建图像。
这是一个使用简单 pypng
模块的示例:
import png
with open("misc.png", "r") as f: # open the file for reading and...
# ... read the file line by line and store numbers as white and others as black pixels
data = [[pixel.isdecimal() for pixel in line] for line in f]
png.from_array(data, "L", {"bitdepth": 1}).save("decoded.png") # use pypng to save it as PNG
对于 misc.png
中的链接数据,将产生 decoded.png
:
用Notepad++打开后发现这是一个二维码 如果 python 有解决此问题的任何库,如何恢复它?
我不会说这是加密的,更像是编码方式,每个白色像素都应该是数字字符,而其他字符应该显示为黑色。 解码 相当容易,然后您可以使用您最喜欢的图像 building/manipulation 库重新创建图像。
这是一个使用简单 pypng
模块的示例:
import png
with open("misc.png", "r") as f: # open the file for reading and...
# ... read the file line by line and store numbers as white and others as black pixels
data = [[pixel.isdecimal() for pixel in line] for line in f]
png.from_array(data, "L", {"bitdepth": 1}).save("decoded.png") # use pypng to save it as PNG
对于 misc.png
中的链接数据,将产生 decoded.png
: