Examine and repair corrupt JPG files before ordering JPEG Repair Service

By | February 26, 2017

It’s a good idea to examine corrupt or damaged JPG files before submitting them for repair to our JPEG Repair Service. Every now and then I am offered corrupt JPEGs that are beyond repair. I can not repair them and I am pretty confident no one else can either.

There are times when JPEGs are simply too damaged. Or damaged to such a degree that it takes me a good part of the day to repair it which I simply can’t do for $10. However, what I do also see regularly is that the files offered contain no usable data at all. With no data to work with, there is nothing to repair.

jpeg only displays part of image due to insufficient data

Only half an image

Also when only part of the image is displayed it is a good idea to check the file:

1. Using a hex editor:

If at some point ‘random’ data turns into a repeating pattern then data is missing and the image can not be repaired.

jpeg missing bottom part

Only half the image because data is missing

If however the random data continues until the end of the file (and even ends with FF D9) then it may very well be possible to repair the image.

2. By examining file size:

If you have files that only partially display, compare their sizes with intact files of same resolution and camera settings. If those reference files are all about for example 4 MB and a file that is only showing the first 50% of the image is 2 – 3 MB then it is unlikely the image can be repaired.

If these partial files are the result of file recovery, they have been recovered incorrectly. Rather than repairing them you’d better try to recover them again using our specialized software for recovery of photo and video from memory cards.

3. Using special JPEG repair software:

Apart from helping you repair corrupt JPEG files, some utilities like JPG-Repair can also help you estimate the condition of a file. JPG-Repair shows you a byte histogram and displays entropy of the data inside the file, both can help you determine if for example a file is filled with just zeros. JPG-Repair 1.8.46 and newer also offer a hex viewer. More details here:

Diagnostics of damaged and corrupt JPEGs

A quick check using the hex editor – Video

Check yourself, by opening the file using a binary or hex editor. In this video I use HxD. It is free and you can get it here: https://mh-nexus.de/en/hxd/.

Using the HxD hex editor to examine corrupt JPG files

The video shows you how to use HxD to quickly check if the file is certain to be beyond repair. The video shows files containing only zeros. It is also possible the files are filled with a repeating patterns. For example ‘FF DD FF DD’ etc.. Or ‘FF FF FF FF’ and so on. Such files can not be repaired, the only similarity with a JPEG file is the JPG file extension. They contain no JPEG markers nor image data.

You can even repair a JPEG using a hex editor

If the file can not be opened, there is a chance it’s header is corrupt. You can some times repair this using the header of an intact file that was taken using the same camera and same settings.

Using HxD: Use Search > Find, search for FF DA using HEX data type. If not found the file is beyond repair.

Find the last instance if FF DA using HxD

Find the last instance if FF DA using HxD

It is possible multiple instances of FF DA are found, you need the LAST one. There may be a few if the JPEG included a thumbnail and preview.

Note: If you find many FF DA byte combinations then you’re probably not looking at JPEG data but random binary data. The file then is probably beyond repair.

Write down the address (Using View >  Offset base you can switch to decimal numbers if you like). Now search for FF D9. Or, go to end of the file which is where you’d normally find FF D9.

Once found, select the entire block including the last FF DA upto and including FF D9 > right click > copy.

Open a new file > Paste Insert > Save as ‘image.jpg’. You have now copied the image data to a new file.

Open a known good file that was shot with the same camera, using same resolution and orientation (portrait/landscape).

Use Search > Find, search for FF DA using HEX data type.

Search, set data type to Hex-values

Search, set data type to Hex-values

It is possible multiple instances of FF DA are found, you need the LAST one.

Select the block preceding the FF DA bytes all the way to the start of the file (FF D8)

Switch to your image.jpg file TAB containing the image data, make sure you’re at offset 0 (zero) > Paste Insert > Save the file.

If damage was limited to the header you should now be able to open your file. Open and Save it using something like Paint.NET (free) to update the file thumbnail (if any).

Note that this entire procedure can be done automatically using my tool JPG-Repair ..

25 thoughts on “Examine and repair corrupt JPG files before ordering JPEG Repair Service

  1. Jai

    I was shooting with GoPro and when i came home, I found that windows was unable to open all the file. I checked Its hex value and it is showing 00 value in all the fields. I just want to know are these file repairable? thank in advance..

    1. Joep Post author

      If entire file content is 00 00 00 etc., then no. The files are simply filled with zeros.

  2. Mai Vo

    Nothing wrong with the drives, I just couldn’t find my pics, I used Diskdrill to see, photos got deleted and it’s not in existing file but it’s in found files when Diskdrill scan. I recovered the photos but not viewable. HDX can’t find FF DA when I tried to recover.

  3. Mai Vo

    I used Diskdrill to recovered deleted photos from WD passport, photos were found, however, after the recovered process, jpg photos not viewable. I tried HXD, can’t find FF DA of the bad photos.
    Please help, can you recover the photos?

    1. Joep Post author

      Can you explain what happened to the drive you recovered data from in the first place?

  4. Şafak E.

    Hello sir,

    I have a question for you. I am music archiver for years. Sometimes one drive becomes suddenly RAW for unknown reason. No bad sector or hardware problem. With years, i become expert on recovering files from these RAW disks. I mean i know which programs works better etc. Now again, suddenly one of my harddrive turned into RAW but this time NTFS file system corrupted very well so files got corrupted also. Only %30 of files are okay and others are corrupted etc. First time seeing something like this… Check out the log, very weird…



    My question is… I had backup of these files on my another harddrive but i deleted them only 1 hour ago before this tragic thing happened. I tried to recover these deleted files from that harddrive. All the filenames, dates, sizes are correct but none of them can be opened. When i checked the HEX Code of those files, all i can see that 00… I did not write anything to that disk. Does MFT entry shows wrong sectors to recovery programs? I feel like Windows 10 not only deleted them in MFT entry but also deleted them in disk also? Do you have any program suggestion to recover deleted files in my situation? Thanks from now and sorry for my long text!

      1. Joep Post author

        File contents reading as 00 00 00 00 is indeed typical symptom of SSD or SMR drives. As far as I understand even those with PC3000 are struggling with SMR drives and deleted file recovery although theoretically is should be possible.

    1. Joep Post author

      You’d normally expect better recovery result with NTFS unless large portion of MFT is corrupt/wiped. If fixups are not what they’re expected then it may indicate MFT is corrupt, fixups are there to detect corruption.
      If the MFT is corrupt a RAW scan may give better result, of course you lose file system meta data + fragmentation becomes an issue.

      RAW may purely be a file system related issue, it is however also common that underlying cause is a physical defect. Simply cloning (sector-by-sector) the drive may already reveal those, plus it’s always a good idea to do so.

      If this is a USB drive, pulling the drive from the enclosure and use SATA <> SATA is a good idea too.

  5. Zeben

    Hey there,

    I’ve got some JPEGs may be too far gone. The SD card went bad and is now unreadable, but I was able to retrieve the files. There is Hex data in the files that seems like real data but they are all missing the FF DA code you said is a must have. My question is, why cant they be fixed without those data points? Am I just looking at junk code?

    1. Joep Post author

      Well, as long as we have a reference file from the same source (so same camera and settings), a lot is possible. Main determining factor for repair is, is actual JPEG data present inside the file. FF DA absent is just one indicator. If you for example use the Extract tool, whether it can extract or not it will show you the entropy. Also, see: https://www.youtube.com/watch?v=9XwhGObWCtY

      What do you mean by the card being unreadble, what are the actual symptoms. So what errors or messages do you get? Is it correctly detected in disk management?

  6. Franklin

    I like the fact that you respond to people’s questions as I was hoping you could help me as well. I unfortunately deleted several photos a few years back and used Stellar to try and recover them however they are corrupt. I did notice that one might be able to be saved and I’ve tried to use Hex Editor and JPeg repair with no results. I was hoping I could send the file to you and you could at least tell me if there’s hope. Regardless of whether it can be saved or not I can pay you for your time and trouble.

  7. Jim

    I have been unloading files of all kinds to a Seagate 5TB (yes, TB) ext HD for a few years. When transferring materials from obsolete PCs to new ones, they all came across to the new drive just fine. There were files on the drive that I have been collecting for years – different cameras, different sources, including emails.

    When the 5TB drive crashed, so did I! I bought recovery software and it returned what files it could find – All MS Office stuff, mp3, mp4, PDF – all my data files and every piece of a file lit cold find. About 15% were recovered in tact, the rest were either some data file where only the extension was ID’d and could be opened; or files with my original file names , but no data.
    I have been separating and refiling what I could ID, but still have about 6000 files to go when I learned HxD just might help. I don’t do gaming, but I do have a youth development & leadership course I now have to rebuild, so I am absorbing all I can about how I can help myself. There are just too many to throw away without trying to salvage them. Any further guidance for this newbie would be appreciated!

    1. Joep Post author

      First advice would be to try other (better) recovery software. Assuming you do like 9 out of 10 do and end up using Stellar, DiskDrill, RecoverIt etc., it can really be worth trying software pros turn to for logical data recovery: ReclaiMe (can be found on this website), R-Studio or UFS Explorer. There is little use in trying to repair recovered files. Specially wwhen only 15% was recovered intact which is a suspiciously low score.

  8. Infostar

    How is it possible that a jpeg or mp4 file have a normal size and resolution but no headers and 00 in the Hexa viewer ??
    I have the same issue and I’m really demoralized cause it’s very important and unique photos and videos that I lost only because I transferred them from internal storage to the sd card !!

    1. Joep Post author

      Yes, this is a frustrating and demoralizing issue, specially because it is often caused by fake memory cards. Fake memory cards only offer a fraction of the advertised capacity. The firmware of the card is hacked to make the camera and your PC think it is larger and that files are saved etc.. In reality photos / videos are never actually stored and this is often discovered when first opening the files.

  9. Irfan HR

    I got a dozen memorable and old photos n videos, recovered from my laptop since my HDD was stolen a few days ago. But, I couldn’t open (INVALID IMAGE). I checked using the HxD and it shows a different pattern and FF DA is also available there. Still I couldn’t open it yet. I tried to use your software but seems like no result occurred.

    Help me

  10. Attila Nagy

    I made videos with GoPro 5. I have some very important but corrupted videos. I can pay for it, if anyone can help me. When I try to fix them I have got this message: FATAL ERROR: The file ‘bad.mp4’ cannot be recovered. The entire file is filled by FF byte! Could anyone help me, please? Thank you. Please send email me. attiii7@yahoo.co.uk

    1. Joep Post author


      What are you using to try fixing the files?

      Anyway, that does not sound good at all. Photos or videos filled with an FF byte pattern are a strong indication that file was stored on a fake memory card. Does not have to be by definition, but it is what I see a lot. Files filled with non data like zeros or FF FF FF can not be repaired by anything or any one.

      What happened exactly? Files were ‘shot’ and then immediately corrupt on memory card?

  11. Kobus

    Hi all,

    As soon as I copied the photos from my phone’s internal storage to the SD card, almost all the files became corrupt.
    I have tried a number of recovery tools with no luck.
    When I came across the the solution of fixing the file header in a HEX editor, I tried it immediately.
    (Out of the couple of hundred photos that was on the phone only about 20 was not corrupted.)
    If I open any of the corrupted files in a hex editor, all the files look the same.

    Example of file being read.

    00000000: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 UUUUUUUUUUUUUUUU
    00000010: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 UUUUUUUUUUUUUUUU
    00000020: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 UUUUUUUUUUUUUUUU
    00000030: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 UUUUUUUUUUUUUUUU
    00000040: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 UUUUUUUUUUUUUUUU
    00000050: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 UUUUUUUUUUUUUUUU
    00000060: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 UUUUUUUUUUUUUUU……

    Any ideas?

    1. Joep Post author

      You copied them? So originals are still on the card? And if so, also 55 55 55 byte pattern? But, if all there is in a file is 55 55 etc, then there is nothing to repair, sorry.

      1. Kobus

        Thanks for the reply.
        Yes I copied them from the phone to the card. And then I tried to repair the files.

        But I only tried to repair the files from the card. The originals that was corrupted on the phone was deleted. I was thinking of trying to recover those delete files and then attempt to repair them, the only problem is that the phone is not with me. It’s on a farm with no signal, so I will need to get all the software beforehand.

        Thanks for the help.


Leave a Reply

Your email address will not be published. Required fields are marked *