darktable article lede image
Using X-Trans cameras with darktable

Using X-Trans cameras with darktable

There is now a development branch of darktable with experimental support for raw files from many recent Fujifilm cameras. These cameras include those with the X-Trans sensor (X-Pro1, X-E1, X20, X100S, X-M1, XQ1, X-E2, and X-T1), X-Series cameras with conventional sensors (X100, X10, X-S1, XF-1, X-A1), and some from Fujifilm’s other lines (S6000fd, E550, IS-1, S3Pro, S5Pro, S5600, E900, S2Pro, S5000, S5200, S5500, S6500fd, S9500, S9600, S9600fd). Previously, darktable would fail to read RAF-type raw files produced by these cameras.

Using darktable with Fujifilm cameras is similar to using it with any other camera’s raw files. There are a few differences, though, in the case of the X-Trans sensor. The X-Trans sensor uses an exotic design (unlike the Bayer pattern which is in most cameras), and hence darktable must use different math to process what the sensor records.

Bayer vs. X-Trans

There will be more technical information about this processing in a second blog post.


The demosaic module has different options when you are working with an X-Trans image. For Bayer images, the module looks something like this:

Bayer demosaic

For X-Trans images, you will see a simpler set of options:

X-Trans demosaic

The “method” sets how darktable processes what the sensor sees (a mosaic of red, green, and blue) into a color image. The current default X-Trans demosaicing is done via a VNG demosaic. This is a decent quality and relatively fast method. For producing images for screen resolution, it should be great. If you are a pixel peeper, or are making large prints, you may not be happy with VNG. It can produce artifacts in fine detail and at sharp edges.

Clicking on VNG will show you some higher quality choices:

X-Trans demosaic methods

Markesteijn 1-pass is a vast improvement over VNG, though it is also twice as slow. If even Markesteijn 1-pass is producing artifacts, the 3-pass variant will offer a slight improvement at the cost of twice as much processing time again. Here are example crops at 200% of the three methods:

demosaic methods

The color smoothing option is the same one used with conventional Bayer sensors. It eliminates color artifacts with a median filter. This may be helpful if you have an image with exceptionally fine detail such as a camera test pattern. Here is an a 200% detail of a problematic X-Trans image with increasing color smoothing applied:

color smoothing

Note that the bright color fringes disappear with more color smoothing.

Processing speed

No matter what demosaic method you use for X-Trans images, darktable will take at least twice as much time to process them as similar Bayer images. In the darkroom view, you may find that the image updates slowly when you adjust modules such as white balance which work directly on the underlying sensor data. This is because darktable goes back to the original raw file to perform these operations, then demosaics the result. While this produces high quality output, it unfortunately requires re-running the demosaic after each adjustment, which takes some time.

One solution is to go to the global preferences, select the “core options” tab, and set “demosaicing for zoomed out darkroom mode” to “always bilinear (fast)”:


When you are not at 100% or 200% zoom, darktable will now display the image with an extremely fast but low quality demosaic method (bilinear). This will allow modules which depend upon the mosaiced image data (any active modules displayed below “demosaic”) to respond more fluidly. The trade-off is that you may see some artifacts as you zoom out the image to just slightly below 100%. Regardless of this setting, image export will always use the method you choose in the demosaic module. The modules which will be more responsive if you choose “always bilinear” are raw denoise, hot pixels, chromatic aberrations (though see the note below), highlight reconstruction, white balance, and invert.

Defaulting to higher quality demosaic

Currently the default demosaic method for new images is VNG. If you want imported image to default to a higher quality default (such as Markesteijn 1-pass), you can do this via a preset. Take any X-Trans image, set the demosaic method to your preference, then click on the “hamburger” menu and choose “store new preset…”:

store new preset

Then choose to auto-apply the preset to raw images from your camera. For example, if you have an “X100S”, you might do this:


Another possibility would be to make a style in the lighttable based on an image for which you’ve applied your chosen demosaic method. Then in Exporter you can choose this style under global options.

Other modules

Other modules besides demosaic should behave as expected. An exception is the “chromatic aberrations” module. It cannot currently handle non-Bayer sensors, and hence will always be disabled for X-Trans images:

chromatic aberrations

If your camera and lens are supported in the “lens correction” module, you may be able to get good results via its TCA correction:

lens correction

Note that support for particular cameras and lenses comes via the great Lensfun project. The version of Lensfun which you have installed will change your lens support.

The basecurve module may have a custom basecurve for particular Fujifilm cameras. Otherwise darktable will use the “fujifilm like” curve, which should be good enough.

The “create HDR” function currently does not work for X-Trans images.

Dynamic Range

When darktable processes X-Trans images, it will not replicate the JPEG which the camera produces. X-Trans cameras have JPEG-specific options such as film simulation, highlight tone, shadow tone, color, and sharpness which do not alter raw file data. You are on your own with darktable to tune the image as you choose – whether to simulate these settings or to do what you feel best serves the particular image.

Of particular note is the Fujifilm “Dynamic Range” option, which controls image contrast. As with similar options on other cameras (“Nikon Active D-Light”, “Canon Auto Lighting Optimizer (ALO)”, “Sony Dynamic Range Optimizer (DRO)” or “Samsung Smart Range”), darktable will not specially handle images taken when Dynamic Range is enabled.

Images taken with DR200, DR400, or AUTO DR will look as expected in lighttable upon import, as darktable will display a camera-processed preview JPEG. But when these images are opened in darkroom mode, they will appear quite dark. Here is how the camera-processed JPEG of a DR400 image looks compared to the image which darkroom mode initially shows:

DR jpeg vs. darktable

What you are seeing in darkroom is the image as recorded by the sensor without post-processing to compensate for the Dynamic Range setting. Dynamic Range exposes the image at a lower ISO without altering f-stop or shutter speed. This preserves highlight detail at the cost of forcing more image data into the dark tones. In photo-talk terms, Dynamic Range and its ilk are an “expose to the left” solution to highlight retention.

As appealing as the DR feature is, it may be worth instead photographing at DR100. You can then turn on the histogram display and alter exposure such that highlights are not cropped while being cognizant of not forcing too much information into the shadows. This should produce similar results to DR200/DR400, with finer control. Of course such images will look too dark initially in both lighttable and darkroom modes, and will also require special care to develop.

Regardless of whether you rely on the DR feature or purposely underexpose, you will most likely want to raise the image exposure overall (e.g. by 1 EV if the image is exposed with DR200, by 2 EV if it is exposed with DR400) while figuring out a way to retain some highlight detail. One way to do the latter is by setting the exposure module’s blend mode to “parametric mask” and setting the gray (“g”) tab’s two input sliders such that the mask starts at black and fades out across the midtones (you’ll have to tune this by eye):

exposure mask

This will lighten the shadows and midtones while smoothly tapering the exposure adjustment in the highlights. Here is that DR400 image processed with an exposure mask:

DR400 with exposure mask

If you don’t appreciate sensor noise, you may want to use a denoise module as well.

There are some other ways to deal with these images: In the “zone system” module, you can set the minimum number of zones and drag the zones to the right. In the “global tonemap” module, you can leave the operator on “drago” and adjust “target” until the the tonality looks right. Or in the “levels” module, drag the middle handle to the left. All those solutions come a bit later in the processing pipeline than the exposure module, hence are not ideal. There has been some suggestion that basecurves specific to particular Dynamic Range modes could also be helpful.

Dealing with Fujifilm Dynamic Range images is, as they say, a field of continuing research. The choices in processing these images are akin to those in processing HDR images – how to fit a large tonal range into a constrained output space. The camera does record EXIF data describing if DR200 or DR400 is set, so it would be interesting to code an automatic compensation for these settings. It is not yet clear, though, what such automatic compensation should be.

Improving and Continuing X-Trans support

Though darktable now can read and process X-Trans files, there are plenty of opportunities to improve camera support. In particular, as mentioned in “ What's involved with adding support for new cameras ”, each camera model could benefit from its own basecurve, white balance presets, lens correction, and noise profile. Bug reports and ideas for improvement are also most welcome.

There has been understandable reluctance to support an exotic image sensor such as the X-Trans. Such support requires much intervention into the darktable code, for a technology which may just be a flash in the pan. But many open source and commercial image processing developers have now either chosen to support X-Trans raw files or are moving towards such support. X-Trans raw handling in darktable allows for enthusiast users of these cameras to enjoy darktable’s finely crafted image processing environment.

Filed under: Blog Development Upcoming Feature Darktable Demosaicing Dynamic Range Fujifilm Interpolation X-Trans
These are comments from the old website, archived as static HTML
  1. Miguel Rozsas on Sat Aug 02 11:26:54 2014:
    Great news !
    I am a X-T1 owner and a Linux user and I am very happy to known Darktable is capable to process my photos. I was very annoyed to changing my workflow from Corel's AfterShot in Linux to whatever in Windows, so I'm glad I can stay in Linux to develop my photos.
    Lets see how it works !
  2. I wonder, if it would be possible to create a Foveon-like sensor with Bayer-like or X-Trans-like pattern, where different pixels would use different stack (different color sensing phototodiode on the top)?
  3. Francesco Riosa on Sat Aug 02 23:34:15 2014:
    No, it's not possible, the foveon sensor play with trasparency of silicon to different wavelengths of light.
    So one particular wavelength will always be read at the same depth in the sensor.
  4. Darktable is the software I use for 2 years to process my RAW images from a Nikon. I'll buy a Fuji X100S these days, I wonder if it is possible to process images of X-Trans sensor in Darktable experimental branch?
    Darktable 1.5 is what I have installed now running under Linux
  5. There is already support for the X-Trans sensor in the experimental branch?
  6. This feature has been merged into the main development branch ("git master") some days ago and is available there.
  7. So, if it's in the main development branch we should expect this on the upcoming 1.5 release.
  8. Almost, the next release will be 1.6 though, 1.5 is the development stage in between. But that are just names.
  9. Kim Timothy Engh on Sat Aug 09 21:48:15 2014:
    Looking foreward to the X-Trans support. Thanks!
  10. Thanks for the great effort,

    a X-M1 happy user
  11. Brilliant bit of news. This is the biggest thing that's stopped me from ditching windows. Always had to keep it around for lightroom.

    Well done everyone.
  12. Peter Chabada on Sun Aug 17 14:10:24 2014:
    I found out also another way to process xtrans raws. Under wine convert raf to dng using Adobe's dng convertor. After that darktable was able to process these images although it was little bit unstable ;). At least try it and compare.
  13. Although my camera is not X-Trans (Fuji X100), I follow this topic with great interest!
  14. Hi,

    I own an X-E2 camera and I'm a linux user too.

    I'm happy Darktable support X-trans RAF now, which make more possibilities for linux users. Personally I was using LightZone beta (which is opensource now and avaible on Linux, Win and Mac)for my X-trans files with nice results too.

    The sole thing is, the perfect software for me would be a mix between Darktable and Lighzone.
  15. Nice to see X-trans RAW files finally supported in Darktable. Great job and thanks for that... Me be I'll try to learn more Darktable use now !

    I use actually LightZone which support X-trans RAF too and give nice result too but with a slightly different "philosophy" but not too far from the Darktable one. As they're both open source software, I dream development make for one could benefit to the other, but I know things are not as simple.
  16. Tom Daston on Tue Aug 19 22:54:11 2014:
    Great news, the X-Trans support is basically the only thing I miss in Linux so far...

    Will definitely follow the news closely and try to support the project by providing at least some bug reports.
  17. I have installed Darktable 1.5 on Ubuntu 14.04 64 bit and can finally process my x-trans images. Can't thank you guys enough, well done! Great news for us Fuji fans. Goodbye lightroom\windows.
  18. Francesco Sani on Mon Aug 25 12:40:09 2014:
    With mac mavericks 10.9.4 dark table doesn't read raw of my fun x-T1!!!! only white display!!! Why it's a new version of dark table 1.4.2
  19. Dear Francesco,

    reading the above article carefully should have revealed, that this is a future feature, just merged into the main development version of darktable (which we call darktable 1.5) AND IS NOT IN ANY STABLE VERSION YET. Obviously not in the (half-a-year-old) version 1.4.2

  20. Francesco Sani on Mon Aug 25 15:34:08 2014:
    ok thank!! and when do you think this version will be published? ;)
  21. "when it's ready".
    Since we're all working on the project only in our spare time there are no fixed plans and release schedules. We will announce it here as soon as we have something ready to be shipped.
  22. Francesco Sani on Tue Aug 26 19:14:05 2014:
    you wrote: "There is now a development branch of darktable with experimental support for raw files from many recent Fujifilm cameras" .
    "Paulo on August 21, 2014 at 14:21 said:
    I have installed Darktable 1.5 on Ubuntu 14.04 64 bit and can finally process my x-trans images. Can’t thank you guys enough, well done! Great news for us Fuji fans. Goodbye lightroom\windows."
    Can i presume that there is an experimental version? or i mistake?How can i have 1.5 for mac?
    Best reguards
  23. There is no package yet, but if you are comfortable with compiling it yourself (like Paolo did), just grab the source and compile it as described here: http://www.darktable.org/2012/08/bringing-current-darktable-to-os-x

    And a warning goes along with that: darktable's database is not "upwards" compatible. This means you can't use darktable 1.4 again on a database opened by a development 1.5 version. So: backup!
  24. Francesco Sani on Thu Aug 28 19:17:48 2014:
    You are very kind, but i'm not so expert... i'll wait 1.5 version.. using iridient.
    Thank very much
  25. Andi Hope on Wed Sep 03 13:26:55 2014:
    Great work guys! Yes, Fuji users are a relatively small user group, but we are far more limited in our options than the big players. We are also pretty loyal. I've been just waiting for this, as a Linux & FOSS enthusiast who is also a proud Fujifilm enthusiast. So, as a Manjaro/Arch user will I find this branch in the AUR or will I have to get it from Github?...
  26. I would really be happy if you decide to support X3F files. Sigma Photo Pro is regarded as something quite bad by others. You could easily capitalize on their weakness and maybe have many Linux converts as a bonus.
  27. Hello !

    I am very very happy that Darktable is able to develop my RAF files !!
    I am a user of darktable for several years...
    You do a great job ! Darktable is my only tool for developing my RAW files
    (Sony ARW, Olympus ORF, Canon CR2, CRW and Fuji RAF)
    Best regards from France

  28. Chris Donahoe on Mon Sep 29 14:23:50 2014:
    Amazing, thank you to everyone who worked so hard on this! I've been following the developments for months now, desperately waiting to be able to get back to using Darktable (I've been using Lightzone since I upgraded by X100 to X100s). I know how much time and effort this took, and I wanted to let those involved know that people out here really appreciate it. Thank you again!
  29. Thank you. I bought my first, cheapest available and RAW-capable camera with accessories, the fujifilm XQ1 cost ~CN¥1550≈US$255, after read this. This was a big spending for me and I have to judge before purchase.