-2

This is png image:

When I open it with Notepad++ I found that this is a QR code How to recover it, if python have any lib for this problem?

Fatworm
  • 105
  • 1
  • 1
  • 5
  • why you open a png with notepad++ in first place? – raviraja Jun 09 '18 at 06:29
  • cause the hint suggest me that. Actually when I open it with a browser I found a base64 code from the sources, decode it and the contend is the same – Fatworm Jun 09 '18 at 06:36
  • 1
    Possible duplicate of [How to decode a QR-code image in (preferably pure) Python?](https://stackoverflow.com/questions/27233351/how-to-decode-a-qr-code-image-in-preferably-pure-python) – hoefling Jun 09 '18 at 11:53

1 Answers1

1

I wouldn't say that this is encrypted, more like encoded in such a way that every white pixel should be a numeric character while other characters should appear as black. That's fairly easy to decode and then you can use your favorite image building/manipulation library to recreate the image.

Here's an example using the simple pypng module:

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

Which, for the linked data in misc.png, will produce decoded.png:

enter image description here

zwer
  • 24,943
  • 3
  • 48
  • 66