Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The "look" of gradients
#1
Out of curiosity, I made a graph to see the effect of the "blending function" in a gradient, and how it behaves if the midpoint is changed.

   

The "50" gradients have the default midpoint position, and the "75" one have the midpoint dragged to 75% of the range.

To replicate, adapt and run this code in the Python console, and copy/paste the result to a CSV that you feed to your favorite spreadsheet application.

Code:
def valueAt(layer,x,y):
    _,rgb=pdb.gimp_drawable_get_pixel(layer,x,y)
    return sum(rgb[:3])/3.

def dumpLayer(layer):
    y=layer.height/2
    pts=['%.1f' % valueAt(layer,x,y) for x in range(layer.width)]
    print '"%s",%s' % (layer.name, ','.join(pts))

def dumpImage(image):
    for layer in [l for l in image.layers if l.visible]:
        dumpLayer(layer)
        

image=gimp.image_list()[0]
dumpImage(image)

Source XCF also attached.

Edit: some code updates (works with alpha channel, and dumps only visible layers)


Attached Files
.xcf   Gradients.xcf (Size: 384.53 KB / Downloads: 228)
Reply


Messages In This Thread
The "look" of gradients - by Ofnuts - 12-18-2022, 10:09 AM
RE: The "look" of gradients - by rickk - 12-18-2022, 09:16 PM
RE: The "look" of gradients - by Ofnuts - 12-18-2022, 11:48 PM
RE: The "look" of gradients - by rickk - 12-19-2022, 01:00 AM
RE: The "look" of gradients - by Ofnuts - 12-19-2022, 01:14 AM

Forum Jump: