Using extendscript (javascript) how can I get the color values from the Photoshop color table -


i'm writing photoshop script in extendscript/javascript , i'm trying verify document using 1 color (plus transparency). change document mode indexed color , values in color table.

i have changed document mode indexed color can't figure out how access color table or color values inside of it.

my working alternative use colorsampler compare values of each pixel, can take couple of minutes run on larger documents , speed issue project.

please let me know if there way access color table or if see way reduce time takes run function.

function sample_color(doc, sample_rate) {     var status = 'pass'     var color_sampler = doc.colorsamplers.add([0,0])     var color_val = false  //first (and only) color value in document     var broke = false     (x=1; x < doc.width; x+=sample_rate){         if (broke){             break         }         (y=1; y < doc.height; y+=sample_rate){             color_sampler.move([unitvalue(x, 'px'), unitvalue(y, 'px')])             try{                 var color = color_sampler.color  //color of current pixel             } catch(e) {                 var color = false  //color_sampler.color fails if pixel transparent             }             if (color != false){                 if (color_val != false){                     if (!color.isequal(color_val)){                         status = 'fail'                         broke = true                         break                     }                 } else {                     color_val = color                 }             }         }     }     color_sampler.remove()     return status } 

xbytor has written couple of scripts accessing colour tables. link may of use you.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -