I don't think there is a way do do that directly... but you can just save the pixmap as png then just open that file in photoshop.
I know data can be saved into files. I'm looking for a way to draw into a layer.
Thanks for any further ideas!
Ok I see but you have to know that this will take a long time, probably more then just saving it as png and opening. I've created a .jsx script that make's a new layer from a pixmap sent from generator.
and in generator you just need to use:
Hey, thanks for writing out a full script. Unfortunately when I try calling it, PS hangs until I force-quit, even for a tiny 10x10 pixel image. This is on OSX, newest PS. Not sure what might be going wrong.
With that said, from how slow you say it will be, maybe what I'm trying to do is impossible. I am basically trying to achieve the effect described in this thread:
My thinking was, if it can't be done with built-in PS features, I could write a generator extension that gets a pixmap of a source layer, runs through the RGBA data applying a threshold to the alpha values, and then writes the result into a target layer. The goal is to be able to see the results of the threshold as you work.
Anyway I'm getting the idea that "drawing into layers" basically isn't a supported thing to do with generator. If you have any other ideas please let me know though!
Hi, it's weird it didn't worked, maybe it's because of the progress bar, I know that sometimes it crashes Photoshop when you have a palette window... I've tested the script with the latest CC version on Windows and it worked fine... Anyway you can do that effect you want directly in Photoshop and with interactivity as well. I've created a screen on how I've done it:
This way when you change the smart object it will automatically update the threshold margins. All you need to be careful is to not have a black with the brightness of 0 in your color. You can have it with a value of 1 instead.
Wow, thanks so much! That's basically what I needed to do, and gets me out of having to mess with Generator.
One small detail - maybe I'm missing a setting, but in your example the edges of the bottom smart layer blend a little with the "Color Fill 4" layer, right? (It will be more obvious with a lower threshold.) In order to avoid this I found that I needed to make 3-5 copies of the lower smart object layer, to make the edges opaque. Or am I missing a setting?
Still though, this really solves my problem, so glad you took the time! Thanks a ton!
Oh and by the way, if you can paste your image into that other thread I linked, I'll go mark it as the correct answer there. It might help someone in the future.
I'm glad I could help, I will put the image in the other thread...
In case somebody is still interested in a "native" solution, well there's no setPixmap function (yet), but I've formally logged a feature request for it to the Photoshop/Generator team – I'll keep this post updated if/when I've news.
As a side note, a proper setPixmap would open the doors to JS image processing – e.g. a context where an HTML Panel can deal with a stream of bits (that is to say, the V8 engine of CEF and not the ExtendScript virtual machine, for I suspect ExtendScript wouldn't be as good as V8). It won't be incredibly fast in terms of performances compared to a native C++ plugin, but to bypass the steep learning curve of actual C++ plugins is a very missed option.