RAW Images
Professional and semi-professional photographers often keep their originals in a lossless RAW format, close to how they were taken with the physical sensor, rather than in a compressed image format like JPEG, especially if they shoot with a digital SLR camera. Newer mobile phones may also be able to capture images in RAW mode. Our goal is to provide top-notch support for all RAW images, regardless of camera make and model. A full list of file types and extensions can be found in our Knowledge Base.
RAW Conversion¶
Since web browsers generally cannot display RAW image files directly, they must be converted. This is done during import or initial indexing. It can also be triggered manually in a terminal with the photoprism convert
command.
Adobe XMP¶
PhotoPrism currently supports Darktable and RawTherapee as RAW image converters (as well as Sips on macOS). Darktable fully supports XMP sidecar files, RawTherapee might only partially. However, XMP is only a "container" format, so the fields (namespaces) used there to indicate how an image should be converted (as well as other metadata) differ between Lightroom/Photoshop, Darktable, and RawTherapee.
In other words, just because an application generally supports XMP that doesn't mean it can use metadata created with another application or by another vendor like Adobe. If you think that's confusing, well, that's because it is. You have an open format, but you still suffer from vendor lock-in - probably not entirely unintentional on Adobe's part.
From our experience, some basic edits done with Adobe tools - such as cropping - might be preserved when you convert the same RAW image with other software like Darktable. Advanced edits, such as lens or color corrections, will likely not be applied.
Darktable¶
If installed, Darktable CLI can be used for RAW image conversion. Note that PhotoPrism will only run one instance of darktable-cli
at the same time if the PHOTOPRISM_RAW_PRESETS
config option is enabled, so existing Darktable presets can be applied (requires an exclusive lock).
Using Darktable as library¶
We had the idea to use cgo and link directly against libdarktable.so
to convert RAW images to JPEG, see darktable-dev mailing list. However this requires calling/wrapping a large number of C functions and also has other disadvantages. The idea is postponed until a clear benefit becomes visible. Running darktable-cli
or any other binary that does the job (see above) seems to be the way to go.
RawTherapee¶
If installed, RawTherapee CLI can also be used for RAW image conversion. If it used by default if Darktable isn't installed or disabled.
JPEG Size Limit¶
RawTherapee cannot limit the resolution of JPEG files when converting files from other formats such as RAW, DNG, HEIC or AVIF. In general, when converting images, the resolution of the generated JPEG files can be limited with the environment variable PHOTOPRISM_JPEG_SIZE
or the CLI parameter --jpeg-size
.
Scriptable Image Processing System (Sips)¶
On a Mac, PhotoPrism can convert multiple files at once using Sips (pre-installed on OS X). It is not available for other operating systems.
Comparison of RAW to JPEG converters¶
- darktable - popular open-source photography app and raw developer; available for Mac, Linux, and Windows; supports XMP (compatible with photoshop/lightroom?)
- Mac OS X ships with sips:
sips -s format jpeg IMAGE.RAW --out IMAGE.JPG
- Photivo - open-source photo processor; available for Mac, Linux, and Windows; no XMP support?
- RawTherapee - open-source RAW image processing app; available for Mac, Linux, and Windows; no XMP support?
- digiKam - open-source digital photo management application based on Qt (KDE); available for Mac, Linux, and Windows; supports XMP (compatible with photoshop/lightroom?)
- UFRaw - Unidentified Flying Raw is a utility to read and manipulate raw images from digital cameras
Tool | Command line options | Compatible OS | JPG Diff* | XMP support | Possible settings | EXIF Diff* | Compatible with Raspberry (ARM64) |
---|---|---|---|---|---|---|---|
Darktable | 1) darktable-cli IMG_0310.CR2 IMG_0310_darktable1.jpg 2) darktable-cli IMG_0310_EDITED.CR2 IMG_0310_EDITED.xmp IMG_0310_EDITED_darktable2.jpg |
macOS, Linux, Windows | **** | yes (but seems to be not compatible with adobe xmps) | ? | **** | yes |
Sips | sips -s format jpeg IMG_0310.CR2 --out IMG_0310_sips.jpg |
macOS | ***** | no | ? | **** | not available for ubuntu |
Rawtherapee | rawtherapee-cli -o IMG_0310_rawtherapee.jpg -c IMG_0310.CR2 |
macOS, Linux, Windows | *** | no | ? | **** | yes |
UFraw | ufraw-batch --out-type=jpg --output=IMG_0310_ufraw.jpg IMG_0310.CR2 |
macOS, Linux, Windows | * | no | ? | ** | yes |
ImageMagick | magick IMG_0310.CR2 IMG_0310_magick.jpg |
macOS, Linux, Windows | * | no | ? | ** | yes |
Digikam | ? | macOS, Linux, Windows | - | - | - | - | - |
Photiva | ? | macOS, Linux, Windows | - | - | - | - | - |
* Compared to JPG/EXIF converted from photoshop |
Image Diff¶
The following table shows the difference between the JPEG files converted by Darktable, Sips, Rawtherapee, UFraw and ImageMagick compared to Adobe Photoshop. Red are pixel that differ from the photoshop version, white are equal pixels. In total 5 Images have been compared (full results). The diff was created using ewanmellor/git-diff-image.
Tool | Diff (left is Photoshop) |
---|---|
Darktable | |
Sips | |
Rawtherapee | |
UFraw | |
ImageMagick |
EXIF Diff¶
The following table shows the difference between the JPG files converted by the tools compared to JPG files converted by photoshop. 5 Images have been compared.
Info | Photoshop | Sips | Darktable | Raw-therapee | Image Magick | UFraw |
---|---|---|---|---|---|---|
Kind | identical | identical | identical | identical | identical | identical |
Size | 2.881.969 bytes (EXIF)/ 2.7M (ls -alh) | 2.673.777 bytes / 2.5M | 5.446.710 bytes / 5.2M always bigger | 3.467.998 bytes / 3.3M | 3.467.998 bytes / 3.3M | 1.558.587 bytes / 1.5M always smaller |
Where | reference | different | different | different | different | different |
Created | reference | different | different | different | different | different |
Modified | reference | different | different | different | different | different |
Dimension | identical - 5472 × 3648 | 5472 × 3648 | different - 5494 × 3666 | different - 5488 × 3662 | different - 5496 × 3670 | different - 5496 × 3670 |
Device Make | refrence | identical | identical | identical | not set | not set |
Colour space | reference | identical | identical | identical | identical | identical |
Colour profile | Adobe RGB (1998) | different - Display P3 | different - sRGB | different - RTv2_sRGB | not set | not set |
Focal length | reference | identical | identical | identical | not set | not set |
Alpha Channel | reference | identical | identical | identical | not set | not set |
Red eye | reference | identical | identical | identical | not set | not set |
Metering Mode | reference | identical | identical | identical | not set | not set |
F number | reference | identical | identical | identical | not set | not set |
Exposure program | reference | identical | identical | identical | not set | not set |
Exposure time | reference | identical | identical | identical | not set | not set |
Latitude | reference | sometimes very small differences | identical | identical | not set | not set |
Longitude | reference | sometimes very small differences | identical | identical | not set | not set |
Adobe Photoshop / Lightroom¶
Ideally we can convert images directly with Photoshop or Lightroom, if installed. It seems like Photoshop comes with some sort of command-line automation tool based on NodeJS: adobe-photoshop/generator-core
This needs further investigation. Contributions welcome!
Todo / Reading List¶
- Compare the quality and XMP compatibility of different RAW converters #65
- Investigate if PhotoShop or Lightroom can be used to convert images on the command line
- Collect example RAW files of common camera brands and models
- Figure out how we can implement "auto-enhance" (automatically fix exposure and write XMP file while converting to JPEG)
- https://howtogimp.com/raw-photos-in-gimp/ - RAW converters to use with GIMP
- mdouchement/hdr - HDR is a library that handles RAW image format written with Golang