RDR2 in-game photos to *more-*valid JPEG files
Found a cool blog from a guy called Jon Sangster. It had a page about Red Dead Redemption 2 - long for rdr2. What a magnificent find! It explained why the in-game photos cannot be opened by most image viewing apps, and how we can actually “extract” the photos from the files produced by the game.
Here goes the ruby code from Jon:
NOTE! Disclaimer, this code is not mine, it is from Job Sangster, the blog I reference above. His GitHub looks very interesting also. If you are interested about software made in C and Ruby, I recommend viewing his repositories. They look interesting :).
# Convert Red Dead Redemption 2 Photos to JPEG.
# Usage: ruby convert.rb < PRDR3834231157 > photo.jpg
prev_byte = 0x00
in_jpg = false
$stdin.each_byte do |byte|
if in_jpg
print byte.chr
exit if byte == 0xD9 && prev_byte == 0xFF
elsif byte == 0xD8 && prev_byte == 0xFF
print "\xFF\xD8"
in_jpg = true
end
prev_byte = byte
end