You can do it by hand, as I used to, or use recoverjpeg
:
dmesg | tail
cd /tmp
sudo dcfldd if=/dev/sde1 of=pix.bin bs=1M count=100
recoverjpeg pix.bin
ristretto image00*
Nothing prizewinning, but better than no picture at all:

Note that you start by copying a reasonable chunk of the partition from the Memory Stick / (micro)SD Card first, to prevent a bad situation from getting worse.
Now I can remember the easy way the next time around this block …
A friend of mine had a partial disk crash before he could back up the pictures of his newborn baby. The software of the day didn’t really do much, so I ended up crafting my own that worked much like your manual approach, combined with a parser that understood JPEG headers. I was able to recover almost 3/4 of the pictures.
You’re a mighty warrior in the battle against entropy!
PhotoRec — https://www.cgsecurity.org/wiki/PhotoRec — is absolutely magic for this. It understands lots of file systems too, so not just for borked camera cards.
I vaguely recall fighting a pitched battle with PhotoRec some years ago, perhaps along with TestDisk, but having a better set of hammers at the ready is always a Good Thing.
Despite their saying “uses read-only access”, I’d still (try to) to copy the entire filesystem for safekeeping. Ya never know what can go wrong or when!
Thanks for the pointer …