Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Constructing an image programmatically (Scripting?)

Community Expert ,
Jun 26, 2018 Jun 26, 2018

I have an idea for building an image to be used as a Displacement Map, basically setting each pixel's color based on its position. I would need Trigonometric functions for this. I'd also prefer to directly make a .PSD, rather than, say, a TIFF, which I'd have to then open and save in PS. What would be a good tool for this? I am currently dipping my toe into Photoshop scripting; would this allow me to do this?

Another possibility is the Pixel Bender Toolkit. I have CS4 installed, so I could run it from inside Photoshop. I looks like this works more directly on images, without all the doc setup stuff one seems to need in PS scripting. Briefly checking it out, it reminds me of an enhanced version of the old "Filter Factory" plugin. I often use Telegraphics​ FF clone, Filter Foundry (not to be confused with Filter Forge​), but it uses integer math for trig, which I'd like to avoid.

Speaking of Filter Forge, I've also got that, but have never dived into the editor. Would this be a good choice?

I've also found some other possibilities, such as  Processing​ or Imageplay​. Anybody here have experience with these? And of course, there's always Matlab, which has a lower-cost Home version, but that may be overkill for what I want. Or I could use Visual Basic. These, though, would start to take me out of the Photoshop universe a bit.

Any thoughts would be appreciated.

1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jun 26, 2018 Jun 26, 2018

Please start by actually explaining what you want to do exactly, maybe it can be partially automated.

Pixel Bender is obsolete so I would stay away from it.

Photoshop Scripting might theoretically be able to achieve what you want but pixel by pixel manipulation would likely result in terrible performance times, so creating a proper plugin with C++ might be better (not that I could do that).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 27, 2018 Jun 27, 2018
LATEST

I'm. away from my computer for a while, so I'll be brief here. The final .result would be a Dmap .to be used in the future. In use, it would make an image .look like it WA printed on a rubber sheet,clamped down at the edges, and inflated like a bubble.

This would be a one-off thing, so I'd like it to be as simple as possiblepossible. I haven't done serious coding in a few years, and I'd like to avoid having to get back to speed in high-level language.

Right now,  I'm actually leaning totowards Pixel Bender, even though it's deprecated, as it's quick and direct. I'll post a sketch of my approach when I'm back at my computer.

I hate the Android keyboard!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 27, 2018 Jun 27, 2018

By far the simplest image format to make programmatically is PPM. See PPM Format Specification It’s very wasteful but that should be ok. It’s just ASCII text and I believe Photoshop can open it (check!). A complete small image;

P3 
# feep.ppm
4 4
15
0  0  0    0  0  0    0  0  0   15  0 15
0  0  0    0 15  7    0  0  0    0  0  0
0  0  0    0  0  0    0 15  7    0  0  0
15  0 15    0  0  0    0  0  0    0  0  0
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 27, 2018 Jun 27, 2018

Hi

If you want to program it you could use C# to build an executable to produce a bitmap using the .Net framework (System.Windows.Media.Imaging namespace)  which you then can save and open in any image application (including Photoshop). The functions allow you to build your bitmap as a mathematical array.

Dave

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 27, 2018 Jun 27, 2018

Just as a suggestion, there is a Photoshop scripting forum here:

Photoshop Scripting

I don't know how active it is, but it might be worth posting there as well.

--OB

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines