Advertisement
Guest User

G'MIC code to simulate color blind vision

a guest
May 7th, 2016
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.79 KB | None | 0 0
  1. #@gmic colorblind : type={ 0=protanopia | 1=protanomaly | 2=deuteranopia | 3=deuteranomaly | 4=tritanopia | 5=tritanomaly | 6=achromatopsia | 7=achromatomaly }
  2. #@gmic : Simulate color blindness vision.
  3. #@gmic : $ image.jpg --colorblind 0
  4. colorblind : -check "isint($1) && $1>=0 && $1<=7"
  5.   -v - s0="protanopia" s1="protanomaly" s2="deuteranopia" s3="deuteranomaly" s4="tritanopia" s5="tritanomaly" s6="achromatopsia" s7="achromatomaly" -v +
  6.   -v + -e[^-1] "Simulate color blindness of type '"${s$1}"' on image$?." -v -
  7.   type0=(0.567,0.433,0;0.558,0.442,0;0,0.242,0.758)
  8.   type1=(0.817,0.183,0;0.333,0.667,0;0,0.125,0.875)
  9.   type2=(0.625,0.375,0;0.7,0.3,0;0,0.3,0.7)
  10.   type3=(0.8,0.2,0;0.258,0.742,0;0,0.142,0.858)
  11.   type4=(0.95,0.05,0;0,0.433,0.567;0,0.475,0.525)
  12.   type5=(0.967,0.033,0;0,0.733,0.267;0,0.183,0.817)
  13.   type6=(0.299,0.587,0.114;0.299,0.587,0.114;0.299,0.587,0.114)
  14.   type7=(0.618,0.320,0.062;0.163,0.775,0.062;0.163,0.320,0.516)
  15.   -repeat $! -l[$>] -split_opacity -l[0] -to_rgb -mix_channels ${type$1} -endl -a c -endl -done
  16.   -v +
  17.  
  18. #@gimp Color blindness : colorblind, gimp_colorblind_preview
  19. #@gimp : Blindness type = choice("Protanopia","Protanomaly","Deuteranopia","Deuteranomaly","Tritanopia","Tritanomaly","Achromatopsia","Achromatomaly")
  20. #@gimp : sep = separator(), Preview type = choice("Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical","Duplicate horizontal","Duplicate vertical")
  21. #@gimp : sep = separator(), note = note{"<small><b>Note:</b>
  22. #@gimp : This filter simulates different types of colorblindness vision.
  23. #@gimp : </small>"}
  24. #@gimp : sep = separator(), note = note("<small>Author: <i>David Tschumperl&#233;</i>.      Latest update: <i>04/20/2016</i>.</small>")
  25. gimp_colorblind_preview :
  26.   -gimp_split_preview "-colorblind $*",$-1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement