Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exposure for Plug-in
#5
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
Reply


Messages In This Thread
Exposure for Plug-in - by trandoductin - 02-13-2025, 02:42 PM
RE: Exposure for Plug-in - by trandoductin - 02-13-2025, 09:29 PM
RE: Exposure for Plug-in - by Ofnuts - 02-13-2025, 09:43 PM
RE: Exposure for Plug-in - by Ofnuts - 02-13-2025, 09:37 PM
RE: Exposure for Plug-in - by trandoductin - 02-14-2025, 12:17 AM
RE: Exposure for Plug-in - by Ofnuts - 02-14-2025, 09:14 AM
RE: Exposure for Plug-in - by trandoductin - 02-16-2025, 03:10 AM
RE: Exposure for Plug-in - by Ofnuts - 02-16-2025, 10:02 AM
RE: Exposure for Plug-in - by rich2005 - 02-16-2025, 09:15 AM
RE: Exposure for Plug-in - by trandoductin - 02-16-2025, 10:23 AM
RE: Exposure for Plug-in - by Ofnuts - 02-16-2025, 05:52 PM

Forum Jump: