Hello everyone
I'm new to scripting in Photoshop but not new scripting. I know MEL and Python, and would like to start learning how to automate things in Photoshop using Python.
I already know about the win32.com -module and the comtypes.client -modules for opening up a connection to Photoshop, so what I need to get into now is the syntax.
But what syntax do you use when scripting with Python? Is it the VBscript documentation or something else I should look at?
Anyway, my first task is to make a script that splits up each color in a flattened image into separate layers. My pseudo-code algorithm look like this:
Code: Select alldocumentColors = array or dictionary with every color in the document stored like I dunno, a tuple or something.
countVar = 1
if colorCount > 32:
return
else:
for color in documentColors
select color (via Color range - 0 fuzziness)
new layer via cut
rename layer to selection_%countVar
countVar += 1
...so now all I need is help finding the commands and the proper syntax to use in order to do this operation.
New to PS-scripting. Want to use Python for color splitting
-
Nightshade
New to PS-scripting. Want to use Python for color splitting
I'm now using the scriptlistener, and getting my head into all the event codes and reading up on javascript again.
So the color range selection and color cutting is piece of cake here - but what I need help with is determining how many colors are in my image and what values those colors have.
I would like to store the colors in a 2d-array or something. How do I do that?
So the color range selection and color cutting is piece of cake here - but what I need help with is determining how many colors are in my image and what values those colors have.
I would like to store the colors in a 2d-array or something. How do I do that?
-
c.buliarca
New to PS-scripting. Want to use Python for color splitting
That is a great idea, but can it be done with Python? I've came close on solving this with javascript, by saving the image as an png, and than just read the palette chunk from the binary text of the png file. I didn't had time to finish the script but the next problem I've got was the fact that the palette had the colors in between the main colors, for example if you have a baked red and blue you will have in the palette the one pixel violet.