The output I get on the console is “start layers = 1”, “here1” but not “here2”.
It looks as if the ‘flattenImage’ doesn’t run. If I try to “save as” the subsequent image I get offered the “-.psd” save option whereas if I then perform a manual “flatten Image” and try the “save as” I get the option to save as ”-.jpg”.
I am not trying to debug the above code as such, I am trying to get the option to save as "-.jpg”
Here I have utilised code generated from the ‘Copy as Javascript’ option for an Action which performs ‘flatten image’. (Where previously I had taken advice from various AI tools. It is still unclear why the previous code didn’t work.)