For future reference:
A while back I was asked to repair some JPEG photos. I was able to do this using a hex editor and some reading on JPEG file format:
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
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
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.
I was then asked by some one else, and then again. I then wrote a small tool that would do this automatically. I think that's a year ago. Since then the tool has developed into something that I think can handle any JPEG issue, assuming the JPEG data is still present. The current status of the tool is shareware.
It's called JPEG Repair Toolkit.