Is it possible to automate applying a custom LUT to RAW files?

Talk about Pixelmator Pro, share tips & tricks, tutorials, and other resources.
User avatar

2021-05-13 05:41:00

I would like to apply a specific custom LUT to some RAW files and export them as JPG files.
I do this manually as follows.

1. Open photo_001.dng -> Apply a custom LUT -> Export as JPG -> Close
2. Open photo_002.dng -> Apply a custom LUT -> Export as JPG -> Close
3. Open photo_003.dng -> Apply a custom LUT -> Export as JPG -> Close
...
100. Open photo_100.dng -> Apply a custom LUT -> Export as JPG -> Close

When there are too many pictures, I get fed up.
Is there a way to automate this?

Thanks.

(This question has been translated into English by a translation tool.)
User avatar

2021-05-14 08:31:25

Sure! We've made the Custom LUT adjustment scriptable so you can quite easily automate workflows like these using AppleScript. For instance, try running the script below in Script Editor — I think it should work for what you're going for:
tell application "Pixelmator Pro"
	activate
	set originalImages to choose file with prompt ¬
		"Please select the images to process:" with multiple selections allowed
	set exportLocation to choose folder with prompt "Please select where you'd like export the images:"
	set myCustomLUT to choose file with prompt ¬
		"Choose the LUT you'd like to apply to the layer:" of type {"com.blackmagicdesign.cube"}
	
	repeat with a from 1 to number of originalImages
		set currentImage to open item a of originalImages
		set imageName to name of currentImage
		tell the front document
			tell the color adjustments of the first layer to set its custom lut to myCustomLUT
		end tell
		
		export currentImage to ((exportLocation as text) & imageName & ".jpg") as JPEG with properties {compression factor:100}
		close currentImage without saving
		
	end repeat
	display notification (number of originalImages as text) & ¬
		" images have been successfully exported." with title "LUT export"
end tell
Also, feel free to let me know in case there's anything you'd like to improve — I'll do my best to help.
User avatar

2021-05-14 11:10:27

Fantastic!
Your script reproduced what I wanted to do completely.
From now on, my time will be greatly saved.
Thank you so much.
User avatar

2021-05-18 07:59:24

You're very welcome!