Imaging API rocks..... Thanks!

I just wanted to say thank you to the Adobe team for releasing the imaging API. I finally had some time to dive into it. Wow, I am super impressed.

When this was being discussed before it was released, one thing I was wondering about was speed… but that is not an issue at all. The get/put works super fast, ever for high resolution images.

Within a couple of days, I have nearly completed a redesign for one of my plugins with an algorithm that I have wanted to implement in it for 13 years. Now I can finally do it :slight_smile:

My users are going to be very happy with it I think.

So thanks for all of the hard work that went into this feature.


Would love to see the plugin and the usecase using these APIs. Thanks for the feedback!

1 Like

It is for my plugin called “EZ Green Screen”. The change will be in version 8 which I will be releasing next week I hope.

This is how I am using the imaging API…

I have always wanted to be able to select pixels based on HSB values but Photoshop doesn’t have native HSB channels or an HSB selection tool. So with the imaging API, I programmed it to convert the RGB values into HSB values, then make a selection and export the selection.


For any readers new to the Imaging API,

I’m curious about the HSB selection. I went digging and found this will work (until we get this covered by DOM). I used the SolidColor class to help with conversions.

  async () => {
      return require('photoshop').action.batchPlay([{
   "_obj": "colorRange",
   "colorModel": 0,
   "fuzziness": 40,
   "maximum": {
        brightness: 89.41023880369268,
        hue: {_unit: "angleUnit", _value: 64.8577880859375},
        saturation: 16.226443884946974,
        _obj: "HSBColorClass"
   "minimum": {
        brightness: 89.41023880369268,
        hue: {_unit: "angleUnit", _value: 64.8577880859375},
        saturation: 16.226443884946974,
        _obj: "HSBColorClass"
 }], {})

Thanks for that.

A long time ago in JSX, I tried forcing the Color Range tool to use HSB instead of Lab by modifying the script listener code, similar like you are doing with UXP here. I never got it working correctly in Extendscript. Although, I can’t remember what the exact issues were that I was having as it was many years ago.

For sure, I will have to test the HSB color range with UXP.

However, I really like what I have done now with the imaging API. The conversion from RGB to HSB is super quick, even on hi resolution images. With my algorithm, I’m doing a little more than just a straight up selection with the HSB. I’m actually combining a few things together before outputting a final mask.

For example, at lower brightness levels, I have found that “green spill” onto black clothing will generally be lower saturation than the green shadows on the screen with the same brightness values. So by getting the HSB values, I can create a variable saturation threshold at differs with brightness levels. I can also set the “fuzziness” separately with H, S, and B. So for example, I can set no fuzziness with B, but have fuzziness with H and/or S. I can also set threshold and fuzziness only on one side. So for example, have a minimum threshold and fuzziness only, but no maximum limit and/or fuzziness.

1 Like