[gegl] operations/workshop/dt-exposure: Add a srgb flag, but default to linear



commit 4e57ea0ff23db81177b2c0c860b7b10fe22586d4
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Feb 8 20:15:09 2017 +0100

    operations/workshop/dt-exposure: Add a srgb flag, but default to linear
    
    Darktable's exposure filter is colourspace-agnostic and works in
    "whatever colourspace the camera is in". For RAW images it operates in
    linear RGB; and for JPEGs in sRGB or any other gamma corrected space
    that might be specified in the file. Hence the output of the filter is
    visibly different depending on whether it is RAW or JPEG.
    
    However, Darktable is optimized for RAW images, and its exposure
    filter is designed accordingly. It's reference behaviour is with RAW,
    and the developers don't care much about JPEGs.
    
    Therefore, let's default to linear RGB and add an option to use sRGB
    in case someone wants to reproduce Darktable's handling of JPEGs.

 operations/workshop/dt-exposure.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/operations/workshop/dt-exposure.c b/operations/workshop/dt-exposure.c
index de7d93f..47189a8 100644
--- a/operations/workshop/dt-exposure.c
+++ b/operations/workshop/dt-exposure.c
@@ -29,6 +29,9 @@ property_double (exposure, _("Exposure"), 0.0)
     description (_("Adjust the exposure correction"))
     value_range (-3.0, 3.0)
 
+property_boolean (srgb, _("sRGB"), FALSE)
+    description (_("Use sRGB gamma instead of linear"))
+
 #else
 
 #define GEGL_OP_POINT_FILTER
@@ -42,9 +45,14 @@ property_double (exposure, _("Exposure"), 0.0)
 static void
 prepare (GeglOperation *operation)
 {
+  GeglProperties *o = GEGL_PROPERTIES (operation);
   const Babl *format;
 
-  format = babl_format ("R'G'B'A float");
+  if (o->srgb)
+    format = babl_format ("R'G'B'A float");
+  else
+    format = babl_format ("RGBA float");
+
   gegl_operation_set_format (operation, "input", format);
   gegl_operation_set_format (operation, "output", format);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]