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

Save a curves preset via a script

New Here ,
Mar 03, 2009 Mar 03, 2009
I am attempting to create a script which will save a settings preset .acv file for a specific curves layer (consistently named for all files) for each file in a specific location, with each .acv having the same name as the document file itself.

While the layer selection, file-naming, etc., are easily accomplished, I can find no Photoshop action or command which will actually save the preset .acv. When trying to record such action with the script listener, the code returned is identical to that for loading a preset of the same name (which is what is accomplished when the script is run).

Does anyone know of a way to save presets via automation? (Sorry if this covers old ground, but I was unable to turn up any discussion, one way or another, as to whether this is possible.)
TOPICS
Actions and scripting
3.1K
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
Explorer ,
Mar 03, 2009 Mar 03, 2009
> Does anyone know of a way to save presets via automation?

Saving presets to disk is generally not the problem, if they are handled by the
Presets Manager.

Unfortunately, curves aren't and I haven't been able to figure out a way to do
it either.

Even worse, the Curves data is stored as raw bytes in the ActionDescriptor for
the adjustment layer.

This leaves two options:
1) When you create a curves layer in the future, have it go through a script
that captures the settings and generates the acv file at the same time. You'll
have to construct the acv file yourself in your script.

2) Decode the raw bytes in the layer's descriptor and generate the acv file
whenever you need it.

Neither option is particularly pleasant so hopefully someone else has something
figured out.

-X
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
New Here ,
Mar 03, 2009 Mar 03, 2009
Thanks X,

I was starting to reach this conclusion, and if you haven't figured it out, I doubt anyone else has.

I don't think I'll have the time to learn/write/debug code for parsing the ActionDescriptors (although I'll add it to my mental to-do list).

What I'm trying to accomplish is getting the hand-edited curves for several thousand tiffs to an overseas client who has local, pre-edited copies, but no means to access the edited versions.

I'm wondering if it would be possible to copy all of the curves layers into several, low-pixel image files (renaming each layer to the appropriate filename), and then re-perform the copy in reverse.

Thanks much again for the insight.
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
Explorer ,
Mar 03, 2009 Mar 03, 2009
> I'm wondering if it would be possible to copy all of the curves layers into several, low-pixel image files (renaming each layer to the appropriate filename), and then re-perform the copy in reverse.

That sounds reasonable. Another (similar) alternative is to get the
ActionDescriptor for the curve layer, save it as a binary file
(ActionDescriptor.toStream() I think), the recreate the curve layer from the
binary file (fromStream()) on the other side. It also avoids going the acv route
but is probably not as easy as doing your layer-copy approach.

-X
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
New Here ,
Mar 03, 2009 Mar 03, 2009
>Another (similar) alternative is to get the
ActionDescriptor for the curve layer, save it as a binary file
(ActionDescriptor.toStream() I think), the recreate the curve layer from the binary file (fromStream()) on the other side. It also avoids going the acv route but is probably not as easy as doing your layer-copy approach.

I like your idea better. Besides being more elegant, it would avoid the problem of trying to split the layers among several (perhaps many) containing image files and then trying to match them up appropriately later. I'm going to have a look at what I can do with .toStream/.fromStream.

Many thanks again.
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
Guru ,
Mar 03, 2009 Mar 03, 2009
I had a look at the rawData in the descriptor and the structure of the acv file.

I think it would be easy to covert the rawData to acv. The 7th byte of the rawData is a BCD of the channels. I can convert that byte using an array or lookup table but is there a better way to do the BCD conversion?
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
Guru ,
Mar 04, 2009 Mar 04, 2009
Using Xbytor's suggestion, I created a sample script that will save an acv file using the data from a curve adjustment layer.

Here is a link to the script http://ps-scripts.com/bb/viewtopic.php?p=10945
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
New Here ,
Dec 06, 2022 Dec 06, 2022

Hi.

Trying to save a curves preset by script too. But this link is broken. Is there other one?

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 ,
Dec 06, 2022 Dec 06, 2022
LATEST

Edit: Sorry, the link that I posted was incorrect.

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
New Here ,
Mar 04, 2009 Mar 04, 2009
Holy cats, Michael... it would have taken me a month in a room with nothing else in it to work that out. I was having enough trouble just figuring out how to get .fromStream to work as intended for re-inserting the descriptors (I am not hardcore).

All I did was pop in the custom file-naming from my original script, and your code is chugging away happily. The 2 step script spat out by the listener (with the re-naming again insterted) should re-load all of those .acv's nicely.)

I'm still wondering what I was doing wrong with the .fromStream. I got all of the descriptors out as binary files with .toStream just fine, and while I could read them back into a var using .toStream, I could not figure out how to use it to actually replace the existing ActionDescriptor of the layer. I suspect my call to get reference to the existing layer may need to be phrased differently.

At any rate, I can't thank you enough. I'm going to hop over to ps-scripts as soon as I get this wrapped up.
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
Guru ,
Mar 04, 2009 Mar 04, 2009
I had the same problem. I haven't used fromStream before and Photoshop choked on the couple of attempts I made.

So instead of trying to get to and from stream working I looked at the raw data from the descriptor and an acv file. I noticed that they where very similar in the curve data parts.

The script was written just to show the concept. I knew as I was writing it that Xbytor could have done a better job if he had time. If you run into any problems using it let me know.

Judging by a few test I made it should be able to handle other color modes with few slight mods.

Mike
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