Converting Pentax PEF Files to PNG

Ufraw is a fantastic utility to convert raw camera formats. You can install it via (And you may as well get the plugin for gimp while you are at it):

sudo yum install ufraw ufraw-gimp
OR
sudo apt-get install ufraw gimp-ufraw

There is a great tutorial on using ufraw from a bash script here, my only recommendation is converting to PNG but it is entirely up to personal preference.

PNG version:
pef2png.sh

#!/bin/bash
 
if [ ! -d ./processed_images ]; then mkdir ./processed_images; fi;
 
# processes raw files
for f in *.pef;
do
  echo "Processing $f"
  ufraw-batch \
    --wb=camera \
    --exposure=auto \
    --out-type=png \
    --compression=96 \
    --out-path=./processed_images \
    $f
done
 
cd ./processed_images
 
# change the image names
for i in *.png;
do
  mv "$i" "${i/.png}"_r.png;
done
for i in *.png;
do
  mv "$i" "${i/imgp/_igp}";
done

Usage:

# Convert all pef files in the current directory to png
./pef2png.sh

Leave a Reply

Your email address will not be published. Required fields are marked *


*