Does this command not work anymore?

I don’t quite understand why you still use getFileForSaving. Again, that will bring up a dialog always. That is the way to ask a user to specify a file (and give permission to access it).

In your case you’re already getting a temp folder, via getTemporaryFolder. You have trivial access to that folder (so no pop-up will occur). Now it’s just a case of creating a file in that folder via createFile (as described here) and pass that to saveAs.

P.S. There’s an almost identical thread in this forum from just a week ago. The person there wanted to save a .jpg. It sounds like you want to save a .png. Check it out.