03-29-2020, 06:02 PM
Hi. Thank you two i finally managed to edit pixels a and with half a day create a little plugin
Supper helpful that you gave a pointer to run the gimp through terminal for error code. Getting the gimp to work at 'core' level moves my core too, orchestra code is the best
Bellow is my master piece. If you would like to try it, try it at different image widths like 180, 360 361, 60 for weird effect. The hue is based on an number that goes up to 360 and start at zero again. Remember to use an alpha layered image.
Supper helpful that you gave a pointer to run the gimp through terminal for error code. Getting the gimp to work at 'core' level moves my core too, orchestra code is the best
Bellow is my master piece. If you would like to try it, try it at different image widths like 180, 360 361, 60 for weird effect. The hue is based on an number that goes up to 360 and start at zero again. Remember to use an alpha layered image.
Code:
#!/usr/bin/env python
from gimpfu import *
def FindColor(hue, opac):
if hue < 60:
return list((255, int(255*(hue/60.0)), 0, opac))
elif hue >= 60 and hue < 120:
return list((255-int(255*((hue%60)/60.0)), 255, 0, opac))
elif hue >= 120 and hue < 180:
return list((0, 255, int(255*((hue%60)/60.0)), opac))
elif hue >= 180 and hue < 240:
return list((0, 255-int(255*((hue%60)/60.0)), 255, opac))
elif hue >= 240 and hue < 300:
return list((int(255*((hue%60)/60.0)), 0, 255, opac))
elif hue >= 300:
return list((255, 0, 255-int(255*((hue%60)/60.0)), opac))
def hueGrade(image, drawable, alphaVal):
gimp.progress_init("Hue chart'n " + image.name + "...")
srcRgn = drawable.get_pixel_rgn(0, 0, image.width, image.height, True, False)
y = image.width*image.height
for x in range(y):
srcRgn[(int(x%image.width), int(x/image.width))] = str(bytearray(FindColor(x%360, int(alphaVal))))
gimp.progress_update(1.0 * x / y)
drawable.update(0,0,image.width,image.height)
pdb.gimp_progress_end()
print('done')
register(
"python-fu-hueGrade",
"Takes an RGBA and produces a hue that covers the whole image",
"Goes along width then down generating a hue based on steped pixel sum; Hue goes from 0 to 359 then repeats",
"FloppaDisk", "FloppaDisk", "2020",
"Hue chart",
"RGBA", # type of image it works on (*, RGB, RGB*, RGBA, GRAY etc...)
[
(PF_IMAGE, "image", "takes current image", None)
, (PF_DRAWABLE, "drawable", "Input layer", None)
, (PF_SLIDER, "alphaVal", "Alpha value", 255, [0, 255, 10])
],
[],
hueGrade, menu="<Image>/Filters/Extra") # second item is menu location
main()