Better Handling of DCM (DICAM) images

A while ago I wrote about converting dicam images to jpeg. It turns out that it’s easier than I would have you believe if you read that post. If you follow the instructions in that post, then you’ll end up with a series of files with .dcm and .jpg names. E.g., foo.dcm and foo.jpg. What I want is for my JPEG files to have the same EXIF tags as the DICAM ones. It’s really easy.This script will do the trick:

for i in *.dcm
do
    exiftool -overwrite_original_in_place -TagsFromFile $i ${i%.dcm}.jpg
done

It turns out that exiftool understands .dcm images. Telling it to pull the tags from the dicam files and put them in the jpeg files was sufficient.