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

File - Automate - Batch

Community Beginner ,
Sep 08, 2022 Sep 08, 2022

Copy link to clipboard

Copied

I would like to create a Batch Action from an Action that changes a photo's HUE value by 1. So that I can create 360 different PNG files.

Is that possible?

In essence the HUE value is a variable that increased by 1 each time it cycles through the Action.

TOPICS
Actions and scripting , Windows

Views

234

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 2 Correct answers

Guide , Sep 08, 2022 Sep 08, 2022

This can be done using batch processing and actions, but with a some problems, so it's easier with a script:

 

var s2t = stringIDToTypeID,
	saveOptions;
try {
	(d = new ActionDescriptor()).putObject(s2t("as"), s2t("PNGFormat"), new ActionDescriptor());
	var saveOptions = executeAction(s2t("save"), d, DialogModes.ALL);
} catch (e) { }
if (saveOptions) {
	var savePath = saveOptions.getPath(s2t('in')).path,
		saveName = saveOptions.getPath(s2t('in')).name.replace(/\.[0-9a-z]+$/, ''),
		offset = 0;
...

Votes

Translate

Translate
Guide , Sep 08, 2022 Sep 08, 2022
var s2t = stringIDToTypeID,
	saveOptions;
try {
	(d = new ActionDescriptor()).putObject(s2t("as"), s2t("PNGFormat"), new ActionDescriptor());
	var saveOptions = executeAction(s2t("save"), d, DialogModes.ALL);
} catch (e) { }
if (saveOptions) {
	var savePath = saveOptions.getPath(s2t('in')).path,
		saveName = saveOptions.getPath(s2t('in')).name.replace(/\.[0-9a-z]+$/, '');
	doProgress('', 'saveToPng()');
	function saveToPng() {
		(r = new ActionReference()).putClass(s2t("adjustmentLayer"));
		(d 
...

Votes

Translate

Translate
Adobe
Guide ,
Sep 08, 2022 Sep 08, 2022

Copy link to clipboard

Copied

This can be done using batch processing and actions, but with a some problems, so it's easier with a script:

 

var s2t = stringIDToTypeID,
	saveOptions;
try {
	(d = new ActionDescriptor()).putObject(s2t("as"), s2t("PNGFormat"), new ActionDescriptor());
	var saveOptions = executeAction(s2t("save"), d, DialogModes.ALL);
} catch (e) { }
if (saveOptions) {
	var savePath = saveOptions.getPath(s2t('in')).path,
		saveName = saveOptions.getPath(s2t('in')).name.replace(/\.[0-9a-z]+$/, ''),
		offset = 0;
	doProgress('', 'saveToPng()');
	function saveToPng() {
		for (var i = 0; i < 360; i++) {
			updateProgress(i + 1, 360);
			(d = new ActionDescriptor()).putEnumerated(s2t("presetKind"), s2t("presetKindType"), s2t("presetKindCustom"));
			d.putBoolean(s2t("colorize"), false);
			(d1 = new ActionDescriptor()).putInteger(s2t("hue"), 1);
			d1.putInteger(s2t("saturation"), 0);
			d1.putInteger(s2t("lightness"), 0);
			(l = new ActionList()).putObject(s2t("hueSatAdjustmentV2"), d1);
			d.putList(s2t("adjustment"), l);
			executeAction(s2t("hueSaturation"), d, DialogModes.NO);
			changeProgressText('saving file: ' + saveName + ' ' + ++offset + '.png');
			saveOptions.putPath(s2t('in'), new File(savePath + '/' + saveName + ' ' + offset + '.png'))
			executeAction(s2t("save"), saveOptions, DialogModes.NO);
		}
	}
}

 

Votes

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
Community Beginner ,
Sep 08, 2022 Sep 08, 2022

Copy link to clipboard

Copied

- simply awesome!!!!!!!! you are the best!!!

as with any request - one simple change if possible (if it makes sense)

since HUE starts at   -180    and ends at    180 --- how can this script be modified for that?

Or does it already ccount for that?

Many kudos

Leon

 

Votes

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
Guide ,
Sep 08, 2022 Sep 08, 2022

Copy link to clipboard

Copied

var s2t = stringIDToTypeID,
	saveOptions;
try {
	(d = new ActionDescriptor()).putObject(s2t("as"), s2t("PNGFormat"), new ActionDescriptor());
	var saveOptions = executeAction(s2t("save"), d, DialogModes.ALL);
} catch (e) { }
if (saveOptions) {
	var savePath = saveOptions.getPath(s2t('in')).path,
		saveName = saveOptions.getPath(s2t('in')).name.replace(/\.[0-9a-z]+$/, '');
	doProgress('', 'saveToPng()');
	function saveToPng() {
		(r = new ActionReference()).putClass(s2t("adjustmentLayer"));
		(d = new ActionDescriptor()).putReference(s2t("null"), r);
		(d2 = new ActionDescriptor()).putObject(s2t("type"), s2t("hueSaturation"), new ActionDescriptor());
		d.putObject(s2t("using"), s2t("adjustmentLayer"), d2);
		executeAction(s2t("make"), d, DialogModes.NO);
		for (var i = 0; i <= 360; i++) {
			updateProgress(i, 360);
			(r = new ActionReference()).putEnumerated(s2t("adjustmentLayer"), s2t("ordinal"), s2t("targetEnum"));
			(d = new ActionDescriptor()).putReference(s2t("null"), r);
			(d1 = new ActionDescriptor()).putEnumerated(s2t("presetKind"), s2t("presetKindType"), s2t("presetKindCustom"));
			(d2 = new ActionDescriptor()).putInteger(s2t("hue"), -180 + i);
			d2.putInteger(s2t("saturation"), 0);
			d2.putInteger(s2t("lightness"), 0);
			(l = new ActionList()).putObject(s2t("hueSatAdjustmentV2"), d2);
			d1.putList(s2t("adjustment"), l);
			d.putObject(s2t("to"), s2t("hueSaturation"), d1);
			executeAction(s2t("set"), d, DialogModes.NO);
			changeProgressText('saving file: ' + saveName + ' ' + -180 + i + '.png');
			saveOptions.putPath(s2t('in'), new File(savePath + '/' + saveName + ' ' + (- 180 + i) + '.png'))
			executeAction(s2t("save"), saveOptions, DialogModes.NO);
		}
		(r = new ActionReference()).putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
		(d = new ActionDescriptor()).putReference(s2t("null"), r);
		executeAction(s2t("delete"), d, DialogModes.NO);
	}
}

Votes

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
Community Beginner ,
Sep 08, 2022 Sep 08, 2022

Copy link to clipboard

Copied

LATEST

Spot on!!!!!!!!

Thank you so very much - you saved me a ton of work.

Leon

Votes

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