Search code examples
pngcorrupt

How to change signature of PNG file to "uncorrupt?"


So I have a corrupted PNG file (that I don't want to convert to JPG, etc. It has to be basically the same.) and I checked its first eight bytes (signature):

8950 4e47 0d0a b0aa

The actual signature for a PNG file is:

8950 4e47 0d0a 1a0a

How can I change the signature of my corrupted file?


Solution

  • Using hexedit you can manipulate your files. For that simply follow these steps:

    1. Install hexedit
    2. Open your file in hexedit
    3. Move the cursor over a byte (here you have to move over the corrupted byte)
    4. Enter what you would like to change the byte
    5. Save the file

    Update

    To install hexedit run following command on terminal:

    sudo apt-get install hexedit
    

    For more info take a look at this blog post.