All posts
CR2 to JPEG via CLI
Develop Canon RAW with dcraw, then encode JPEG with pnmtojpeg.
Open online converterPackages to install
You need dcraw to read CR2 and netpbm for the pnmtojpeg encoder.
dcraw
netpbm
sudo apt-get update
sudo apt-get install -y dcraw netpbmHow to run the command
dcraw -w writes a .ppm next to the RAW using camera white balance. Then pnmtojpeg encodes that PPM as JPEG.
dcraw -w photo.cr2
pnmtojpeg photo.ppm > photo.jpegDockerfile example
Build a minimal Ubuntu image with the required packages and run the conversion inside the container.
FROM ubuntu:24.04
RUN apt-get update && \
apt-get install -y --no-install-recommends \
dcraw \
netpbm && \
rm -rf /var/lib/apt/lists/*
WORKDIR /work
docker build -t cr2-to-jpeg .
docker run --rm -v "$PWD:/work" -w /work cr2-to-jpeg \
dcraw -w photo.cr2Example commands
Run these locally after installing the packages, or inside the container from the Dockerfile.
dcraw -w photo.cr2
pnmtojpeg photo.ppm > photo.jpegdcraw -w RAW_001.CR2 && pnmtojpeg RAW_001.ppm > RAW_001.jpg