JPG-Repair Toolkit allows you to recover data from corrupted PEF photos (JPEG). Pentax RAW photos (PEF) contain the raw, ‘undeveloped’ sensor data. JPG-Repair Toolkit can process multiple Pentax RAW files (PEF) files in batch.
Commonly Pentax RAW photos embed one or more JPEGs: a low resolution thumbnail, a medium resolution preview, and in many cases a full frame preview. One thing mentioning about Pentax RAW photos is that the ones I have come across all contained restart markers. Restart markers are a mechanism that prevent bit corruption in the image data stream from affecting the rest of the image. Normally a single bit error can distort color and shift image data throughout the rest of the JPEG.
Technically JPG-Repair Toolkit does not repair PEF photos, it extracts JPEGs already embedded! Of course having undeveloped and unprocessed RAW data is probably preferable, the full frame JPEG is hardly worthless.
How to recover data from corrupted PEF photos using JPG-Repair Toolkit
Time needed: 1 minute, assuming you have downloaded JPG-Repair Toolkit.
To determine signatures I examined RAW files taken from: http://www.rawsamples.ch/index.php/en/canon.
And also: https://www.wesaturate.com/.