02-14-2025, 12:17 AM
(This post was last modified: 02-14-2025, 12:40 AM by trandoductin.)
But the I wrote my python code based on GEGL code as seen below
static void
process_rgba (GeglOperation *op,
void *in_buf,
void *out_buf,
glong n_pixels,
const GeglRectangle *roi,
gint level)
{
GeglProperties *o = GEGL_PROPERTIES (op);
gfloat *in_pixel;
gfloat *out_pixel;
gfloat black_level = (gfloat) o->black_level;
gfloat diff;
gfloat exposure_negated = (gfloat) -o->exposure;
gfloat gain;
gfloat white;
glong i;
in_pixel = in_buf;
out_pixel = out_buf;
white = exp2f (exposure_negated);
diff = MAX (white - black_level, 0.000001);
gain = 1.0f / diff;
for (i=0; i<n_pixels; i++)
{
out_pixel[0] = (in_pixel[0] - black_level) * gain;
out_pixel[1] = (in_pixel[1] - black_level) * gain;
out_pixel[2] = (in_pixel[2] - black_level) * gain;
out_pixel[3] = in_pixel[3];
out_pixel += 4;
in_pixel += 4;
}
}
Hackathon,
Ran my function on a layer and delete half of it.
Then ran exposure on the original other half and see how much darker it is.
So I used
simulate_gimp_exposure(image,layer,0.002,1.696/2.05) #dividing 2.1-ish or 2.05 to match for specific 1.696 exposure.
pretty close I hope it's good enough for my client
static void
process_rgba (GeglOperation *op,
void *in_buf,
void *out_buf,
glong n_pixels,
const GeglRectangle *roi,
gint level)
{
GeglProperties *o = GEGL_PROPERTIES (op);
gfloat *in_pixel;
gfloat *out_pixel;
gfloat black_level = (gfloat) o->black_level;
gfloat diff;
gfloat exposure_negated = (gfloat) -o->exposure;
gfloat gain;
gfloat white;
glong i;
in_pixel = in_buf;
out_pixel = out_buf;
white = exp2f (exposure_negated);
diff = MAX (white - black_level, 0.000001);
gain = 1.0f / diff;
for (i=0; i<n_pixels; i++)
{
out_pixel[0] = (in_pixel[0] - black_level) * gain;
out_pixel[1] = (in_pixel[1] - black_level) * gain;
out_pixel[2] = (in_pixel[2] - black_level) * gain;
out_pixel[3] = in_pixel[3];
out_pixel += 4;
in_pixel += 4;
}
}
Hackathon,
Ran my function on a layer and delete half of it.
Then ran exposure on the original other half and see how much darker it is.
So I used
simulate_gimp_exposure(image,layer,0.002,1.696/2.05) #dividing 2.1-ish or 2.05 to match for specific 1.696 exposure.
pretty close I hope it's good enough for my client