Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Need help with randomizing gradient fills

New Here ,
Aug 28, 2021 Aug 28, 2021

Copy link to clipboard

Copied

Hello,

I'm struggling to automate a task where a set of about 300 jpegs are opened, a gradient adjustment layer is added, linear, at a random angle, the gradient type is "noise", with transparency, 25% roughness, and randomized color option, then saved to a new jpeg. 

I can get it all to work except for the randomization.  I keep getting the same color combination, even though when recording the action I click "randomize" several times.  I guess that doesn't work and it saves only that particular seed.  I have tried looking everywhere for a script to that gets close to what I need, but haven't found any specific to this.  I am very novice and can't even modify the scripts I have found with any success.  Can anyone please point me in the right direction?

 

 

I should add, the "random angle" is not as critical as the "random colors" so that can be left out if it's not possible...

TOPICS
Actions and scripting

Views

66

Likes

Translate

Translate

Report

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

correct answers 1 Correct answer

Adobe Community Professional , Aug 28, 2021 Aug 28, 2021
s2t = stringIDToTypeID; (r = new ActionReference()).putClass(s2t("contentLayer")); (d = new ActionDescriptor()).putReference(s2t("null"), r); (d2 = new ActionDescriptor()).putUnitDouble(s2t("angle"), s2t("angleUnit"), Math.floor(Math.random() * 360)); d2.putEnumerated(s2t("type"), s2t("gradientType"), s2t("linear")); (d3 = new ActionDescriptor()).putEnumerated(s2t("gradientForm"), s2t("gradientForm"), s2t("colorNoise")); d3.putBoolean(s2t("showTransparency"), true); d3.putInteger(s2t("smoothnes...

Likes

Translate

Translate
Adobe Community Professional ,
Aug 28, 2021 Aug 28, 2021

Copy link to clipboard

Copied

LATEST
s2t = stringIDToTypeID;

(r = new ActionReference()).putClass(s2t("contentLayer"));
(d = new ActionDescriptor()).putReference(s2t("null"), r);
(d2 = new ActionDescriptor()).putUnitDouble(s2t("angle"), s2t("angleUnit"), Math.floor(Math.random() * 360));
d2.putEnumerated(s2t("type"), s2t("gradientType"), s2t("linear"));
(d3 = new ActionDescriptor()).putEnumerated(s2t("gradientForm"), s2t("gradientForm"), s2t("colorNoise"));
d3.putBoolean(s2t("showTransparency"), true);
d3.putInteger(s2t("smoothness"), 1024);
d3.putEnumerated(s2t("colorSpace"), s2t("colorSpace"), s2t("RGBColor"));
d3.putInteger(s2t("randomSeed"), Math.random() * 10000000000000);
d2.putObject(s2t("gradient"), s2t("gradient"), d3);
(d1 = new ActionDescriptor()).putObject(s2t("type"), s2t("gradientLayer"), d2);
d.putObject(s2t("using"), s2t("contentLayer"), d1);
executeAction(s2t("make"), d, DialogModes.NO);

Likes

Translate

Translate

Report

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