2 Replies Latest reply on Nov 4, 2014 8:03 AM by wayneyo654

    JSX issues - select pixels / nearest pixel


      Hi everyone!

      What I got so far...:

      - *.psd file (@1000x1000) with several layers with only single pixels (rest: transparency) - each layer's pixels have their own color (e.g. layer_00 contains only 10 pixels with #FF00FF; layer_01 #AA00FF)
      - *.jsx is reading those layers and writes their single pixels positions into a *.txt file (this is really SOLW!!!)


      In order to speed things up I was thinking about a reduced selection (reduced to an area containing information only) instead of searching the whole image. Therefore, I had that "select pixels" function on my mind which is available by RMB on the layer's image... So, another idea was to select everything and then crop the selection down to the non-transparent pixels.
      I was not able to find a solution for both of it, even I did a search on the guide and reference.


      A third idea might be a little questioning:
      - Copy the layer's information
      - Open new document and paste it
      - Crop it and (that's the point I don't know how) get the info about how many pixels have been cropped from the left and the top, in order to add this later to my positions
      - Start the *.jsx I mentioned above (with mentioned addition)


      One more question for the pros (as this would be the greatest, as I'd only have to name a starting position):
      Is there a simple way to search for a 'nearest pixel with same color information'?


      Thx and regards,

        • 1. Re: JSX issues - select pixels / nearest pixel
          JJMack Most Valuable Participant

          It sounds like using the layers bounds to limit the pixels search area would shorten the processing time if that is not currently what the script does and layer pixels are clustered . Also you can use the histogram set to selected layer to get layer pixel count. This thread would be better placed in the Scripting forum. Photoshop Scripting

          • 2. Re: JSX issues - select pixels / nearest pixel
            wayneyo654 Level 1


            Sorry for posting this in the wrong section...Kinda missed the Scriptig forum :/ (How to move this thread? Can't figure it out)


            Thx for the answer, but that's not quite what I thought of...

            I don't want the number of pixels of each layer - I want their positions. So, the histogram is not a solution.


            Meanwhile, I was able to script this 'select pixels' function and using its bounds - so, thx for the hint!