Skip to content

Instantly share code, notes, and snippets.

@skoji
Last active June 9, 2019 09:15
Show Gist options
  • Save skoji/240dd38fa0c30a74ecd76a8c0b2c3e19 to your computer and use it in GitHub Desktop.
Save skoji/240dd38fa0c30a74ecd76a8c0b2c3e19 to your computer and use it in GitHub Desktop.
Pentax RAW file to jpeg, preserving creation date
filename = ARGV[0]
raise "specify PEF file." unless filename =~ /.PEF$/ # should change according to what you want to convert
raise "file #{filename} does not exists." unless File.exist?(filename)
stat = File::Stat.new(filename)
converted = filename.sub(/.PEF$/, ".jpg")
raise "convesion failed" unless system "convert #{filename} #{converted}"
File.utime(stat.mtime, stat.mtime, converted)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment