channels_monochromatic.py 680 B

123456789101112131415161718192021222324
  1. # Channels > Make monochromatic
  2. # (fr) Canaux > Rendre monochrome
  3. from lazpaint import image, dialog, layer, filters, colors
  4. translation = dialog.translate_dict(["This is not a chromatic channel"])
  5. channel = layer.get_registry("split-channel")
  6. if channel == "R" or channel == "C":
  7. source = "red"
  8. elif channel == "G" or channel == "M":
  9. source = "green"
  10. elif channel == "B" or channel == "Y":
  11. source = "blue"
  12. elif channel == "H":
  13. layer.fill(colors.GRAY)
  14. exit()
  15. elif channel is None:
  16. colors.grayscale()
  17. exit()
  18. else:
  19. dialog.show_message(translation["This is not a chromatic channel"])
  20. exit()
  21. filters.filter_function(red = source, green = source, blue = source)