Never rewrite code before understanding architecture.
Never replace GTK with Qt blindly.
First identify reusable components.
Separate:
a. Darktable backend
b. Darktable desktop UI
Create diagrams where useful.
Produce reports in markdown.
If assumptions are made, clearly mark them.
For every dependency, classify:
Required
Optional
Desktop-only
Mobile-friendly
Sailfish availability unknown
Suggest alternatives where Darktable components are unsuitable.
At the end provide:
feasibility report
estimated project size
recommended architecture
recommended technology stack
Final deliverables:
Bootstrap repository layout
Architecture analysis
Development environment setup
Testing strategy
CI strategy
Backend extraction feasibility study
Roadmap for building a Sailfish-native RAW editor
Here is some recent information from a web search. Use it to answer the user's question if it's relevant:
Source: darktable-org/darktable | DeepWiki (https://deepwiki.com/darktable-org/darktable)
The darktable_t structure is defined at src/common/darktable.h352-418 and instantiated as a global variable at src/common/darktable.c126 This singleton pattern provides centralized access to all major subsystems.
It serves as an entry point for developers who want to understand how darktable's components fit together. For detailed information about specific subsystems: Core initialization and module loading: see Core Architecture
darktable employs a plugin architecture with three primary module types:
The application targets professional and enthusiast photographers working with RAW image files from digital cameras. As of version 5.6.0, darktable supports hundreds of camera models with specific noise profiles, white balance presets, and color matrices.
The darktable_t structure is defined at src/common/darktable.h352-418 and instantiated as a global variable at src/common/darktable.c126 This singleton pattern provides centralized access to all major subsystems.
Source: Darktable vs. Imagen: Open-Source vs. AI Editing (https://imagen-ai.com/valuable-tips/darktable-vs-imagen/)
Every edit in Darktable happens ... The architecture is built around modules, letting you reach for something as simple as crop, exposure, or spot removal, or stack up more advanced tools for the look you want...
Every edit in Darktable happens non-destructively, all the way through the processing pipeline, so your original RAW file is never modified. The architecture is built around modules, letting you reach for something as simple as crop, exposure, or spot removal, or stack up more advanced tools for the look you want.
If you are weighing how to spend your post-production hours, you have probably come across both Darktable and Imagen, even though the two tools sit in very different parts of a photographer’s kit. Darktable is free, open-source software that photographers and developers build together for processing RAW files on your own computer.
Inside one non-linear project you cull, edit, review, and export in whatever order suits the job, then come back to it later if you need to. Darktable, meanwhile, keeps its longstanding structure: a lighttable for organizing and rating your images, and a darkroom view where you build up an edit module by module.
This guide walks through what each tool actually offers today, checked directly against Darktable’s own site and documentation rather than old marketing claims, so you can see where the two genuinely differ and where they simply solve different problems.
Source: The future of darktable · aurelienpierreeng/ansel Wiki (https://github.com/aurelienpierreeng/ansel/wiki/The-future-of-darktable)
If we summarize, darktable has a major performance bottleneck through OpenCL and Gtk. Yes, OpenCL allows to unleash the power of the GPU, but it has an incompressible overhead of memory buffers copies.
A Darktable fork minus the bloat plus some design vision. - aurelienpierreeng/ansel
If we summarize, darktable has a major performance bottleneck through OpenCL and Gtk. Yes, OpenCL allows to unleash the power of the GPU, but it has an incompressible overhead of memory buffers copies. This is grounded in its architecture and will not be solved by another hack-in-place.
Something has to give, all these constraints together are simply too much. darktable has been pushed already farther than what its initial design allowed, in ways that have introduced architectural brittleness and a patchwork of ugly fixes.
In the early 2010's, raw photographs had 12-16 Mpx and a crappy dynamic range that happened to be on-par with the one of the typical desktop display. darktable was designed for this : to work on CPU, with Gtk, on 10-12 MB files having a reduced dynamic range.
Source: Darktable: Features, Alternatives & Analysis (2026) (https://appmus.com/software/darktable)
For users processing large volumes of images, Darktable offers strong batch editing capabilities, streamlining repetitive tasks. Non-destructive Editing: All edits are stored in a separate file, leaving the original raw file untouched. Modular Architecture: Editing tools are organized as modules, which can be applied in any order within the processing pipeline.
For users processing large volumes of images, Darktable offers strong batch editing capabilities, streamlining repetitive tasks. Non-destructive Editing: All edits are stored in a separate file, leaving the original raw file untouched. Modular Architecture: Editing tools are organized as modules, which can be applied in any order within the processing pipeline.
Comprehensive guide to Darktable. Darktable is a powerful, open-source and free photography workflow application and raw developer, offering professional-grade tools for managing and editing digital negatives. It's a non-destructive editor designed by photographers for photographers.
Darktable stands out as a robust and free open-source alternative for photographers looking for a comprehensive workflow solution. It is specifically designed to handle raw files with a focus on providing complete control over the editing process without altering the original image data.
Darktable is a comprehensive and powerful open-source photography workflow application and raw developer. It's designed by photographers for photographers, and this is evident in its focus on raw image processing and non-destructive editing.
Source: about | darktable (https://www.darktable.org/about/)
darktable is an open source photography workflow application and raw developer. A virtual lighttable and darkroom for photographers. It manages your digital negatives in a database, lets you view them through a zoomable lighttable and enables you to develop raw images and enhance them.
Raw is the unprocessed capture straight from the camera’s sensor to the memory card, nothing has been altered. There are multiple alternatives in the open source world for raw development (ufraw, dcraw, rawtherapee) but darktable tries to fill the gap between the excellent existing free raw converters and image management tools (such as e.g. ufraw, rawstudio, f-spot, digikam, shotwell). It focuses on the workflow to make it easier for the photographer to quickly handle the thousands of images a day of shooting can produce. It’s also one of the very few FOSS projects able to do tethered shooting.
The internal architecture of darktable allows users to easily add modules for all sorts of image processing, from the very simple (crop, exposure, spot removal) to the most advanced (simulation of human night vision).
The user interface is built around efficient caching of image metadata and mipmaps, all stored in a database. The main focus lies on user interaction, both in terms of a smooth interface design as well as processing speed. High quality output is also one of our goals.
All editing is fully non-destructive and only operates on cached image buffers for display. The full image is only converted during export. Raw image loading is done using rawspeed, high-dynamic range and standard image formats such as jpeg are also supported. The core operates completely on floating point values, so darktable can not only be used for photography but also for scientifically acquired images or output of renderers (high dynamic range).
For a more complete list of darktable’s current features have a look at the features page. Or– even better– just install it and try it out!
darktable is released under the terms of the GNU General Public License Version 3 or later.
Source: AI Subsystem | darktable-org/darktable | DeepWiki (https://deepwiki.com/darktable-org/darktable/6-ai-subsystem)
The core of the AI subsystem is a static library (darktable_ai) that wraps the ONNX Runtime (ORT).
darktable-org/darktable · Index your code with · DevinEdit WikiShare · Loading... Last indexed: 17 May 2026 (9a61cd) Overview · Core Architecture · Build System · Image Processing Pipeline · Development Context and Pixelpipe · IOP Module System · Module Order and IOP Ordering ·
The following diagram maps high-level system concepts to their specific implementations in the darktable source tree.
The core of the AI subsystem is a static library (darktable_ai) that wraps the ONNX Runtime (ORT).
Models are not bundled with the darktable binary.
Source: Build System | darktable-org/darktable | DeepWiki (https://deepwiki.com/darktable-org/darktable/1.2-build-system)
Darktable's plugin architecture compiles modules as shared libraries (MODULE targets in CMake).
Darktable's plugin architecture compiles modules as shared libraries (MODULE targets in CMake).
Darktable uses CMake as its build system generator. CMake produces native build files (Makefiles or Ninja files) from the project's CMakeLists.txt files.
The build system manages compilation of the core lib_darktable shared library, plugin modules, and executable binaries.
The darktable build process involves several stages, from platform detection to module linking.
Source: Scripting and Extensibility | darktable-org/darktable | DeepWiki (https://deepwiki.com/darktable-org/darktable/8-scripting-and-extensibility)
To facilitate migration from other software, darktable includes specialized logic for handling external metadata formats. The most prominent is the Lightroom import compatibility layer, which maps Lightroom's XMP metadata fields to darktable's ...
This section provides an overview of how darktable can be extended and automated through its Lua scripting engine and command-line interfaces. darktable provides a deep integration for Lua, allowing users to manipulate the database, UI, and export pipelines.
darktable-org/darktable · Index your code with · DevinEdit WikiShare · Loading... Last indexed: 17 May 2026 (9a61cd) Overview · Core Architecture · Build System · Image Processing Pipeline · Development Context and Pixelpipe · IOP Module System · Module Order and IOP Ordering ·
To facilitate migration from other software, darktable includes specialized logic for handling external metadata formats. The most prominent is the Lightroom import compatibility layer, which maps Lightroom's XMP metadata fields to darktable's internal structures.
For a detailed breakdown of the darktable.* namespace, the event system, and widget creation, see Lua Scripting API.
At all times main memory was one of the most limited resources in computing. Although from 20 years to now the memory setup of a typical desktop PC has increased by a factor of several thousands (from less than a megabyte to a few gigabytes), we still need to consider how to efficiently handle that resource.
The reason of course lies in the increasing demands of modern applications. Today it might be darktable which is the single most challenging software to hit the boundaries of your system.
A simple calculation makes this clear. If you have a 20MPx image, DT for precision reasons will store this internally as a 4 × 32-bit floating point cell for each pixel. Each full image of this size will need about 300MB of memory. As we want to process the image, we will at least need two buffers for each module – one for input and one for output. If we have a more complex module, its algorithm might additionally require several intermediate buffers of the same size. Without further optimization, anything between 600MB and 3GB would be needed only to store and process image data. On top we have darktable’s code segment, the code and data of all dynamically linked system libraries, and not to forget further buffers where darktable stores intermediate images for quick access during interactive work (mip map cache). All in all darktable would like to see a minimum of about 4GB to run happily.
Available address space
Besides the total amount of system memory there is another limiting factor: the available address space of your hardware architecture. How much memory can be addressed by a process depends on the number of address bits your CPU offers. For a CPU with 32-bit address registers, this is 2^32 bytes, which makes a total of 4GB. This is the absolute upper limit of memory that can be used by a process and it constitutes a tight situation for darktable as we have seen above.
darktable’s escape route is called tiling. Instead of processing an image in one big chunk, we split the image into smaller parts for every processing step (module). This will still require one full input and output buffer, but intermediate buffers can be made small enough to have everything fit into the hardware limits.
Setting up darktable on 32-bit systems
As we’ve seen 32-bit systems are difficult environments for darktable. Still many users are successfully running DT on them, if the basic requirements in terms of total system memory and the topics mentioned in the paragraphs above are addressed properly.
There are several adjustment parameters to get it running. If you make a fresh install, DT will detect your system and set conservative values by default. However, if you upgrade DT from an older version (e.g. coming from 0.9.3 and going to 1.0), chances are you have unfavorable settings in your preferences. The consequences might be DT aborting due to allocation failures or – very typically – DT not being able to prope
Source: Darktable - Wikipedia (https://en.wikipedia.org/wiki/Darktable)
Darktable (stylized as darktable) is a free and open-source photography application and raw developer. Rather than being a raster graphics editor like Adobe Photoshop or GIMP, it comprises a subset of image editing operations specifically aimed at non-destructive raw image post-production.
Modular architecture · Organize images and search by parameters · Translated into 19 languages · Support for controlling cameras through darktable and directly saving to the PC (tethered capture) Find similar photos · Support for geographical coordinates labels with display of photo locations on map ·
Support for drawn masks was added in Darktable version 1.4, allowing application of effects to manually specified areas of an image. There are five mask types available: brush, circle, ellipse, Bézier path, and gradient; all are resizable, allow fade-out radius for smooth blending and can have their opacity controlled.
Darktable has two main modes: "lighttable" and "darkroom". Each represents a step in the image development process. Two more modes are tethering and a map view. Upon launching, lighttable opens by default, where image collections are listed.
A filmstrip with other images is displayed at the bottom, and can be sorted and filtered using lists from the upper panel. The latter also gives access to the preferences configuration. Darktable's configuration allows custom keyboard shortcuts and personalized defaults.
Source: darktable(1) — Arch manual pages (https://man.archlinux.org/man/darktable.1.en)
Most processing is done in 32-bit floating point per channel mode in device independent CIE Lab* color space. darktable is also fully color managed, which gives you full control over the look of the photos. The application relies on a modern plugin architecture thus making it easy for 3rd ...
Most processing is done in 32-bit floating point per channel mode in device independent CIE Lab* color space. darktable is also fully color managed, which gives you full control over the look of the photos. The application relies on a modern plugin architecture thus making it easy for 3rd party developers to extend the existing capabilities of the application.
You may optionally supply the filename of an image or the name of a folder containing image files. If a filename is given darktable starts in darkroom view with that file opened. If a folder is given darktable starts in lighttable view with the content of that folder as the current collection.
If there is already an instance of darktable running (using the same library) the image or folder will be opened there, using D-Bus to communicate between the two processes.
You may temporarily overwrite individual settings on the command line with this option - however, these settings will not be stored in "darktablerc".
Source: Image Metadata and Data Management | darktable-org/darktable | DeepWiki (https://deepwiki.com/darktable-org/darktable/4-image-metadata-and-data-management)
The dt_image_t structure is the central data container for all image metadata in darktable.
darktable-org/darktable · Index your code with · DevinEdit WikiShare · Loading... Last indexed: 17 May 2026 (9a61cd) Overview · Core Architecture · Build System · Image Processing Pipeline · Development Context and Pixelpipe · IOP Module System · Module Order and IOP Ordering ·
It covers how darktable stores, retrieves, and manages metadata for images in the library, including the core data structures, database schema, caching mechanisms, and file I/O operations.
The dt_image_t structure is the central data container for all image metadata in darktable.
Darktable maintains image metadata across multiple storage layers, each serving a specific purpose in the application's workflow:
Myth: “Free cannot be as good as professional software.”Reality: Darktableis professional software.
isprofessional software.
Many beginners believe that darktable is a “hobby alternative” to Lightroom because it costs nothing. That is a misconception. Darktable is Free Open Source Software (FOSS) and is developed by scientists, mathematicians, and photographers who do not have to make compromises for marketing departments.
**The Engine:**Darktable calculates internally with 32-bit floating-point precision. This is more accurate than many commercial programs.
**The Science:**Modules likeColor Balance RGBorDiffuse or Sharpenare based on current color research (2020+), while commercial tools often still build on older standards to remain “simple.”
The Result:If you master darktable, the image quality (sharpness, color fidelity, dynamic range) is oftenvisibly betterthan the competition.
The price is not 0 Euro because it is “cheap”, but because it means Freedom.
3. Independence Instead of Subscription Compulsion (FOSS)
Darktable is not just “free.” It is Free Software. Your images belong to you: No cloud, no catalog compulsion, no subscription that expires. You can still open your RAWs in 10 years without paying monthly rent. No Black Box Principle: With commercial software, you never know exactly what a slider does. Darktable is transparent. You have full control over the mathematics behind your image. Platform Independence: Darktable runs natively on Linux, Windows, and macOS. It runs equally stable on all systems (Windows, Mac, Linux). Transparency & Community: You can view the code if you wanted to. Development is transparent and driven by a dedicated community, not commercial interests. No “Vendor Lock-in”: Your edits are saved in separate .xmp files. You are not tied to a proprietary catalog.
Your metadata (tags, ratings) are safe in open XMP files. Your RAWs remain untouched. But beware: As with any RAW converter, the editing itself is not transferable to other programs. Therefore: Always export your finished images as JPG/TIFF!
In Summary:
Darktable is like an extremely precise, modular toolbox, a laboratory for light. Lightroom is more like a very well-equipped, user-friendly designer studio.
Darktable offers you maximum technical control and uncompromising quality – if you are willing to engage with the ‘Why’. The learning curve is steeper, yes. But the reward is a deeper understanding of your photography and an editing power that gives you visibly better results than the standard.
December 30, 2025
Source: Darktable — Grokipedia (https://grokipedia.com/page/Darktable)
Hot pixels, which appear as persistent bright spots due to sensor defects, are handled by the hot pixels module, which automatically detects and interpolates them based on neighboring values during demosaicing.[76][77][78][79] Perspective and keystone distortions, common in architectural or tilted shots, are addressed by the rotate and perspective module, which warps the image to straighten converging lines and correct shear using control points or automatic line detection, simulating a tilt-shift lens effect while allowing rotation and scaling to fit the frame. These corrections can be selectively applied using the masking system for targeted regions. In darktable 5.2 (released June 2025), enhancements to lens correction include improved profile reading from OM System and Olympus files, expanding automatic detection for recent cameras.[80][25][81]
Hot pixels, which appear as persistent bright spots due to sensor defects, are handled by the hot pixels module, which automatically detects and interpolates them based on neighboring values during demosaicing.[76][77][78][79] Perspective and keystone distortions, common in architectural or tilted shots, are addressed by the rotate and perspective module, which warps the image to straighten converging lines and correct shear using control points or automatic line detection, simulating a tilt-shift lens effect while allowing rotation and scaling to fit the frame. These corrections can be selectively applied using the masking system for targeted regions. In darktable 5.2 (released June 2025), enhancements to lens correction include improved profile reading from OM System and Olympus files, expanding automatic detection for recent cameras.[80][25][81]
For instance, event hooks can automatically run checks or modifications upon importing new photos, integrating seamlessly with Darktable's workflow tools to streamline non-destructive editing pipelines.[98] These features support programmatic control over modules and image operations, enabling advanced automation like conditional tagging based on file properties or EXIF data.[99] In Darktable 5.2, released in June 2025, the Lua API was enhanced with action support, allowing scripts to define and execute custom keyboard shortcuts or button actions directly within the interface, alongside other
Darktable is a free and open-source photography workflow application and raw image developer designed for photographers, functioning as a virtual lighttable for organizing digital negatives and a darkroom for non-destructive editing and enhancement.[1] It manages raw files in a database, supports zoomable viewing, and enables export in various formats while preserving original images through a modular pixel pipeline.[2] Founded in 2009 by German developer Johannes Hanika, a photographer with a background in computer graphics, Darktable emerged as a collaborative project between programmers and
Darktable is a free and open-source photography workflow application designed
Source: Chapter 10. Special topics | usermanual | darktable (https://darktable.gitlab.io/doc/en/special_topics_chapter.html)
Besides the total amount of system memory there is another limiting factor: the available address space of your hardware architecture. How much memory can be addressed by a process depends on the number of address bits your CPU offers. For a CPU with 32-bit address registers, this is 2^32 bytes, which makes a total of 4GB. This is the absolute upper limit of memory that can be used by a process and it constitutes a tight situation for darktable as we have seen above.
Besides the total amount of system memory there is another limiting factor: the available address space of your hardware architecture. How much memory can be addressed by a process depends on the number of address bits your CPU offers. For a CPU with 32-bit address registers, this is 2^32 bytes, which makes a total of 4GB. This is the absolute upper limit of memory that can be used by a process and it constitutes a tight situation for darktable as we have seen above.
For this reason, as of darktable 2.0, 32-bit support is soft-deprecated. There's not much to be said here. Of course also 64-bit systems require a sufficient amount of main memory, so the 4GB plus swap recommendation holds true. On the other hand, 64-bit architectures do not suffer from the specific 32-bit limitations like small address space and fragmentation madness.
Without further optimization, anything between 600MB and 3GB would be needed only to store and process image data. On top we have darktable's code segment, the code and data of all dynamically linked system libraries, and not to forget further buffers where darktable stores intermediate images for quick access during interactive work (mip map cache).
From what I said before, it is evident that your computer needs a sane memory setup to properly run darktable. We suggest that you have a least 4GB of physical RAM plus 4 to 8GB of additional swap space installed.
Source: Introducing the darktable app store | darktable (https://www.darktable.org/2015/03/introducing-the-darktable-app-store/)
Today we are happy to announce a big new feature that we will not only ship with the big 2.0 release later this year but also with our next point release, 1.6.4, which is due in about a week: even more darkroom modules!
One of the big strengths of darktable has always been its varied selection of modules to tweak your image. However, that has also been one of the main points of criticism: too much, too many and too complicated to grasp. To make it easier for the user to deal with the flood of tools darktable has had the “more modules” list since many years. It changed its appearance a few times, we added module categories, allowed to select favorite modules, and all of that has proven to be useful. Thus there have always been people that approached us with great new ideas for new modules, especially since we moved to GitHub a while ago with its powerful Pull Request system, yet we couldn’t accept many of them. Some were not that great codewise, some didn’t really fit our product vision– and then there were some that looked nice and certainly benefited some users, but we felt it wasn’t generic enough to justify polluting our module list even more. Of course this was a bad situation, after all these people invested quite some time into providing us with a new feature that we turned down. No one likes to waste their time.
Who will also like it are module developers. Writing new image modules has always been quite easy: clone the darktable sources, create one new C file and add it to the CMake system. But that was only the first part, after all you wanted to allow people to use your work in the end. So you either had to convince us to include your module into the official darktable release (with the problems outlined above), or provide a patched version of darktable for people to compile themselves. In theory you could also have provided a binary package or just the module compiled into a shared library for people to just copy to their install directory, but we have never seen anyone taking that route. With our new module system this will become easier. Instead of creating a patched version of darktable you can now make use of our Module Developers Package which contains all the required header files and a CMake stub to quickly compile your module into a shared library that can be used with a stock installation of darktable. And since we will release these files under a LGPL license you could even write non-free modules. Once you are happy you can submit your code for us to review (this step is still manual to prevent malicious code being shipped) and once we approved it everyone can install the module.
All of the things described until now are implemented already and will be part of the next releases. Once it has proven to be working reliably we also plan to allow developers to make some money with their work as an incentive to attract more a
Source: darktable (https://www.darktable.org)
darktable is an open source photography workflow application and raw developer. A virtual lighttable and darkroom for photographers. It manages your digital negatives in a database, lets you view them through a zoomable lighttable and enables you to develop raw images and enhance them.
Have a look at our current features and how to install it on your system. And if you're new to darktable, the FAQ will answer many of your questions.
darktable is created for photographers, by photographers.
Having developers that are also avid photographers as part of the target audience is good for understanding the real world problems, challenges, and workflows.
darktable edits your images non-destructively all the way through its pipeline. Your original image is never modified! Professional color management features ensure fidelity all the way to print and GPU accelerated processing means you can speed up your workflow using your video card.
You do not need to write code to be involved in the darktable community! You can help other users by providing your input on the mailing list or the forum. If you'd like to show others what darktable is capable of, contribute to the Flickr page. If you can write code, check out the source code!
I'll perform a comprehensive technical analysis and create the complete project foundation for a Sailfish OS RAW editor leveraging Darktable's backend. This is a substantial architectural undertaking.
PHASE 1: FULL TECHNICAL DISCOVERY
docs/architecture/darktable-analysis.md
1. Executive Summary of Darktable Architecture
Darktable is a sophisticated C/C++ application with a monolithic core (lib_darktable) and plugin-based modules. The architecture is built around a global singleton darktable_t (defined in src/common/darktable.h:352-418, instantiated at src/common/darktable.c:126) that provides centralized access to all subsystems.
Key Architectural Characteristics:
Language: C (core), C++ (some modules), Lua (scripting)
Build System: CMake with custom macros for module plugins
# RawFlow - Sailfish OS RAW Photo Editor
A native Sailfish OS RAW photography workflow application inspired by Lightroom Mobile,
powered by Darktable's image processing engine.
## Features
- **Library Management**: Import, organize, rate, and tag RAW photos
- **Non-destructive Editing**: Exposure, white balance, crop, lens correction
- **Professional Pipeline**: 32-bit float processing, color management
- **Export**: JPEG, PNG, TIFF with quality control
- **Sailfish Native**: Silica UI, gesture-based navigation, ambience support
## Architecture
RawFlow separates Darktable's backend (image processing, database, metadata) from its
GTK UI, providing a clean C++ API consumed by a Qt/QML frontend.
Desktop prototype (Qt Widgets for rapid iteration)
Unit tests for RAW loading
CI pipeline setup
Phase 2: Sailfish Integration (Months 3-4)
Port to Sailfish SDK
QML/Silica UI implementation
Library view (grid, import, rating)
Basic editor (exposure, WB)
Export to JPEG
Phase 3: Feature Complete (Months 5-6)
Crop/rotate
Lens correction
Color management (ICC)
History/undo
XMP sidecar support
Performance optimization (tiling, threading)
Phase 4: Polish (Month 7)
OpenCL acceleration (optional)
Batch export
Cloud sync (optional)
Sailfish Store submission
Phase 5: Advanced (Future)
AI features (ONNX Runtime)
Tethered shooting
Advanced masking
Presets/styles
6. Immediate Next Steps
Create repository with structure above
Vendor Rawspeed and verify it builds in Sailfish SDK
Extract imageio_rawspeed.c into standalone C++ class
Create minimal Qt app that loads a RAW and displays it
Implement exposure IOP as first editing operation
Add JPEG export
7. Risk Mitigation
Risk
Mitigation Strategy
Rawspeed build fails on Sailfish
Pre-build static library on desktop, link statically
Memory exhaustion on mobile
Implement 512x512 tiling immediately, not as optimization
Sailfish SDK Qt version too old
Target Qt 6.2 features only, avoid 6.5+ APIs
GPL compliance
Keep all code GPL-3.0, document Darktable attribution
Performance too slow
Profile early, consider NEON optimizations for aarch64
Conclusion
The project is feasible and recommended. Darktable's backend is extractable despite its GTK UI coupling. The singleton pattern (darktable_t) is the primary architectural hurdle, but solvable with dependency injection.
Critical Success Factors:
Do not attempt to port Darktable's UI - Rewrite in QML
Extract backend incrementally - Start with RAW loading, add IOPs one by one
Test on device early - Sailfish emulator may not reflect real performance
Optimize for mobile - Tiling, threading, battery efficiency are mandatory
Estimated Timeline: 6-7 months to MVP with 2 developers.
License: GPL-3.0-or-later (compatible with Darktable).
This analysis is based on Darktable 5.x architecture as of 2026. Specific line numbers and file paths may vary in future versions. Always verify against the actual source code when beginning implementation.
Yes, but with important distinctions between system-wide display calibration (difficult/impossible on Sailfish) and app-specific color management (fully achievable and actually better for a photo editor).
Here's the technical breakdown for Sailfish OS 5.1 on Jolla Phone 2026:
1. System-Wide ICC Profile Changes: ❌ Not Practical
Why it's difficult:
Sailfish OS uses Wayland (Lipstick compositor) without a full colord daemon like desktop Linux
Display color calibration is typically handled at the kernel/device tree level or by the GPU driver, not userspace
The Jolla Phone 2026 display panel has factory calibration baked into the display driver
No standard mechanism to load ICC profiles system-wide like xcalib or dispwin on desktop
What you'd need (not recommended):
Root access (devel-su)
Modifying /sys/class/backlight/ or display driver parameters
Custom Wayland compositor with ICC support (major undertaking)
Risk of bricking display calibration
2. App-Specific Color Management: ✅ Recommended Approach
For a RAW editor, software color management inside the app is superior to system ICC profiles because:
You control the transform pipeline (camera profile → working space → display)
You can support wide gamut displays in the future
You don't affect other apps
Works on any Sailfish device without root
Implementation Strategy for RawFlow
A. Use Qt 6's Built-in Color Management (Qt 6.2+)
Sailfish OS 5.1 ships with Qt 6.2+, which has excellent color space support:
cpp
// In your backend bridge
#include <QColorSpace>
#include <QImage>
QImage RawProcessor::applyDisplayTransform(const QImage& input) {
// Image comes in with its source profile (e.g., Adobe RGB, ProPhoto)
QColorSpace sourceProfile = input.colorSpace();
// Transform to display space (sRGB for most phone displays)
// Or detect/calibrate the actual display
QColorSpace displayProfile = QColorSpace::SRgb;
QImage output = input;
output.convertToColorSpace(displayProfile);
return output;
}
B. Advanced: Custom Display Calibration (User-Adjustable)
Since you can't change the system ICC profile, implement in-app display calibration:
qml
// In your EditorPage.qml
Item {
// User-adjustable display calibration
property real gammaR: 2.2
property real gammaG: 2.2
property real gammaB: 2.2
property real whitePoint: 6500 // Kelvin
// Apply via shader or C++ curve lookup
ShaderEffect {
property variant source: imageSource
property real gammaR: parent.gammaR
// ... fragment shader applies gamma correction
}
}
C. Professional Approach: lcms2 Integration
For accurate camera-to-display transforms (what Lightroom does):
cpp
#include <lcms2.h>
class ColorManager {
public:
// Transform from camera raw space to display
QImage transformToDisplay(const QImage& rawImage,
const QString& cameraProfilePath) {
cmsHPROFILE cameraProfile = cmsOpenProfileFromFile(
cameraProfilePath.toUtf8().constData(), "r");
cmsHPROFILE displayProfile = cmsCreate_sRGBProfile();
cmsHTRANSFORM transform = cmsCreateTransform(
cameraProfile,
TYPE_RGB_FLT, // 32-bit float for precision
displayProfile,
TYPE_RGB_8, // 8-bit for display
INTENT_PERCEPTUAL,
0
);
// Apply transform to pixel data
// ... (integrate with your pixelpipe)
cmsDeleteTransform(transform);
cmsCloseProfile(cameraProfile);
cmsCloseProfile(displayProfile);
return transformedImage;
}
};
3. Detecting the Display Profile (Best Effort)
On Sailfish, you can attempt to detect display characteristics:
cpp
QString detectDisplayProfile() {
// Check for known display profiles in system
QStringList paths = {
"/sys/class/drm/card0-HDMI-A-1/edid", // If external display
"/usr/share/color/icc/", // Unlikely on Sailfish
"/etc/colord/" // Unlikely on Sailfish
};
// Fallback: Assume sRGB (most phone displays are sRGB or close)
// Or provide user calibration sliders
return "sRGB";
}
4. Practical Workflow for RawFlow
Recommended pipeline:
RAW Decode: Rawspeed outputs linear RGB (scene-referred)
Input Profile: Apply camera-specific color matrix (from Darktable's colorin module)
Working Space: Convert to Lab or ProPhoto RGB (32-bit float)
Display Transform:
If user has calibrated: Apply custom display profile
Default: Transform to sRGB with perceptual intent
Advanced: Detect if display supports P3 (future Jolla phones?) and use that
cpp
// Simplified pipeline in your backend
QImage RawProcessor::processForDisplay(const QImage& linearRGB) {
// 1. Apply camera profile (from Darktable's color matrices)
QImage profiled = applyCameraProfile(linearRGB);
// 2. Tone mapping (filmic, exposure, etc.)
QImage tonemapped = applyToneCurve(profiled);
// 3. Convert to display space
// Option A: Standard sRGB
QImage display = tonemapped.convertToColorSpace(QColorSpace::SRgb);
// Option B: User-calibrated display profile (if implemented)
// QImage display = applyCustomDisplayProfile(tonemapped);
return display;
}
5. User Calibration UI (Critical for Accuracy)
Since you can't fix the display hardware, give users tools to compensate:
When exporting, embed the correct profile so other devices see accurate colors:
cpp
// Export with embedded profile
void Exporter::exportJPEG(const QImage& image, const QString& path) {
QImage output = image;
// Ensure sRGB for web/sharing, or Adobe RGB for print
if (!output.colorSpace().isValid()) {
output.convertToColorSpace(QColorSpace::SRgb);
}
// Embed ICC profile in JPEG
output.setColorSpace(QColorSpace::SRgb);
output.save(path, "JPEG", 95);
}
Summary
Approach
Feasibility
Effort
Result
System ICC Profile
❌ Very Low
High (root, kernel mods)
Risky, affects all apps
App Color Management
✅ High
Medium
Professional, controllable
User Display Calibration
✅ High
Low
Compensates for hardware variance
lcms2 Pipeline
✅ High
Medium
Accurate camera-to-screen
Recommendation for RawFlow:
Implement software color management using Qt 6 QColorSpace or lcms2
Add user calibration sliders (gamma, white point) in settings
Default to sRGB display transform with perceptual intent
Support embedding ICC profiles in exports
Document that the display itself may not be color-accurate, but the app shows the correct colors relative to a calibrated reference
This gives you Lightroom Mobile-level color accuracy without needing to modify the Sailfish OS system files.
Yes, AirDrop-compatible transfers can be implemented on Sailfish OS, but with an important technical distinction: you cannot implement Apple's proprietary AWDL (Apple Wireless Direct Link) protocol natively, but you can implement AirDrop-compatible cross-platform file sharing using open standards that works with iPhones, Androids, and other Sailfish devices.
Here's the complete technical analysis for integrating this into your RAW editor project:
1. Technical Breakdown: What "AirDrop" Actually Is
Apple's AirDrop uses a 3-layer stack:
Layer
Technology
Sailfish OS Availability
Discovery
Bluetooth LE (BLE) beacons + mDNS/Bonjour
✅ Available (BlueZ 5.x + Avahi)
Connection
AWDL (Apple Wireless Direct Link) - proprietary Wi-Fi P2P
❌ Not available (closed source, patented)
Transfer
TLS-encrypted HTTP/HTTPS over AWDL
⚠️ Replaceable (use Wi-Fi Direct or LAN)
The Blocker: AWDL is Apple's proprietary Wi-Fi Direct variant. It cannot be legally reverse-engineered for Sailfish OS without risking DMCA issues.
The Solution: Implement an AirDrop-compatible protocol using open standards that iPhones can interoperate with via third-party apps (like LocalSend, Snapdrop, or OpenDrop).
2. Implementation Strategies for Sailfish OS
Option A: Port LocalSend (Recommended)
LocalSend is an open-source, cross-platform AirDrop alternative (Flutter-based) that works on Linux.
Pros: Battle-tested, end-to-end encrypted, works with iOS/Android apps
Cons: Flutter on Sailfish requires Wayland compatibility layer
Implementation: Run LocalSend as a service, integrate with your RAW editor via D-Bus
Option B: Native C++/Qt Implementation (Best for your project)
Build a native Sailfish component using:
BlueZ D-Bus API for BLE discovery/advertising
ConnMan or NetworkManager for Wi-Fi Direct/P2P
QtNetwork for HTTP/WebSocket transfers
Avahi for mDNS service discovery
Option C: OpenDrop Protocol Implementation
Port the OpenDrop protocol (Python reference) to C++/Qt. This implements the actual AirDrop protocol for receiving files from iPhones (with limitations).
3. Architecture for RAW Editor Integration
mermaid
graph TB
subgraph "Sailfish Device"
A[RAW Editor App] -->|D-Bus| B[Transfer Service]
B -->|BLE| C[BlueZ Daemon]
B -->|Wi-Fi| D[ConnMan/Wi-Fi Direct]
B -->|HTTP| E[Local HTTP Server]
end
subgraph "Peer Devices"
F[iPhone with LocalSend/Snapdrop]
G[Android Phone]
H[Desktop Linux/Mac]
end
C -.->|BLE Discovery| F
C -.->|BLE Discovery| G
E <-->|TLS HTTP| F
E <-->|TLS HTTP| G
E <-->|TLS HTTP| H
Core Components to Build
1. BLE Discovery Service (C++/Qt)
cpp
// transfer/discovery_service.h
class DiscoveryService : public QObject {
Q_OBJECT
public:
explicit DiscoveryService(QObject* parent = nullptr);
// Advertise as "RawFlow-Editor" via BLE
void startAdvertising(const QString& deviceName);
// Scan for peers (iPhones running LocalSend, etc.)
void startScanning();
signals:
void peerDiscovered(const QString& address, const QString& name, const QVariantMap& capabilities);
void peerLost(const QString& address);
private:
QBluetoothDeviceDiscoveryAgent* m_discoveryAgent;
QLowEnergyController* m_leController;
};
Integrate with Sailfish's native share system so users can:
Receive: Share RAW files to RawFlow from Files app, Gallery, or AirDrop-compatible apps
Send: Share edited photos from RawFlow to other devices
cpp
// share/rawflow_share_plugin.cpp
#include <lipstick-qt5-jolla/jolla-qt5_share_plugin.h>
class RawFlowSharePlugin : public JollaQt5SharePlugin {
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.sailfishos.sharing.rawflow")
public:
QString title() const override { return "RawFlow Editor"; }
QIcon icon() const override { return QIcon(":/icons/rawflow.png"); }
// Called when user shares a RAW file to RawFlow
bool share(const QStringList& filePaths, const QString& mimeType) override {
// Import RAW files into library
return m_importController->importFiles(filePaths);
}
};
4. Protocol Implementation Details
Discovery Phase (BLE)
Advertise using Service UUID: 0xFEAA (Google Eddystone) or custom UUID with manufacturer data containing:
Device name ("Jolla-RAW-Editor")
Supported formats (CR2, NEF, ARW, DNG, JPEG)
App version
cpp
// BLE Advertising data structure
QByteArray manufacturerData;
QDataStream stream(&manufacturerData, QIODevice::WriteOnly);
stream << quint16(0xFFFF) // Company ID (use test ID or register one)
<< quint8(0x01) // Protocol version
<< deviceName.toUtf8();
Transfer Phase (HTTP over Wi-Fi Direct or LAN)
Handshake: Exchange TLS certificates via BLE (or use PSK - Pre-Shared Key displayed on screen)
Negotiation: HTTP POST to /api/localsend/v2/prepare-upload (LocalSend protocol) or custom REST API
Transfer: Multipart HTTP POST with chunked transfer encoding for large RAW files (50MB+)
Verification: SHA-256 checksum validation
Security Considerations
E2E Encryption: Use TLS 1.3 with self-signed certificates exchanged via BLE
Authentication: 6-digit PIN displayed on screen (like AirDrop's "Nearby" verification)
File Validation: Scan incoming RAWs for exploits before processing (Rawspeed is C++, buffer overflows possible)
5. Integration with RAW Workflow
Import Workflow
code
iPhone Camera Roll → LocalSend App → [BLE Discovery] → Sailfish RawFlow → Import to Library → Generate Thumbnail → Edit
Since Sailfish uses Wayland, ensure your transfer UI works with:
Silica components (native Sailfish look)
Gesture navigation (swipe to dismiss transfer dialogs)
Ambience support (dark/light mode for transfer UI)
7. Recommended Implementation Path
Phase 1: Basic P2P (Month 1)
Implement BLE discovery using BlueZ
HTTP server for receiving files on local network
Basic QML UI for "Receive" and "Send" buttons
Phase 2: LocalSend Compatibility (Month 2)
Implement LocalSend protocol v2 (REST API compatible)
Test with iOS LocalSend app
Add progress indicators and file type filtering (accept only RAW/JPEG)
Phase 3: Wi-Fi Direct (Month 3)
Implement Wi-Fi P2P using ConnMan or wpa_supplicant P2P
Fallback to LAN if P2P unavailable
Optimize for large RAW files (50MB+) with resume capability
Phase 4: Polish (Month 4)
Sailfish Share plugin integration
Background service for auto-receive
Thumbnail preview during transfer
Integration with Library (auto-import received files)
8. Code Example: Minimal Viable Transfer
cpp
// main.cpp - Minimal AirDrop-compatible receiver
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QBluetoothLocalDevice>
#include <QTcpServer>
int main(int argc, char *argv[]) {
QGuiApplication app(argc, argv);
// 1. Start BLE advertising
QBluetoothLocalDevice localDevice;
localDevice.setHostMode(QBluetoothLocalDevice::HostDiscoverable);
// 2. Start HTTP server for file transfer
QTcpServer server;
server.listen(QHostAddress::Any, 53317); // LocalSend default port
// 3. Register with QML
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty("transferServer", &server);
engine.load(QUrl("qrc:/main.qml"));
return app.exec();
}
9. Existing Projects to Leverage
Project
Language
Sailfish Compatibility
Notes
LocalSend
Flutter/Dart
⚠️ Needs Wayland port
Best UX, E2E encrypted
OpenDrop
Python
✅ Port to C++
Actual AirDrop protocol (receive only)
Snapdrop
Web/JS
✅ WebView or port
WebRTC-based, no app needed on sender
KDE Connect
C++/Qt
✅ Already ported?
Full device integration
Warp
C++/Qt
✅ Native
KDE's AirDrop alternative
10. Limitations & Workarounds
Limitation
Workaround
No native AWDL
Use LocalSend app on iPhone (user installs app)
iOS Background restrictions
Use "Nearby Share" web fallback for iOS Safari
Large RAW files (100MB+)
Chunked transfer with resume, compression optional
Battery drain (BLE scanning)
Scan only when app is active, use duty cycling
Conclusion
Yes, implement this. For your RAW editor, AirDrop-compatible transfers solve the critical workflow problem of getting photos from camera/phone to Sailfish device quickly without cables or cloud services.
Recommended approach:
Start with LocalSend protocol compatibility (works with existing iOS/Android apps)
Build native C++/Qt service using BlueZ + QtNetwork