Skip to main content
Participant
October 26, 2020
Answered

[Extenscript] exportCurrentFrameAsPNG - exports only the first frame of the sequence

  • October 26, 2020
  • 1 reply
  • 665 views

I'm using the PPROPanel Extesion, Ihave an active sequence, then I'm selecting some frame(playing with the time line selection) and then click on 'Export sequence frame'.

I can see the new image file, but every image is the same - the first frame of the sequence regardless the sequence player position.

The same result received by clicking 'Export frames for markers' - all markers has the same image (the first frame of the sequence).

What amo I doing wrong?

thanks.

This topic has been closed for replies.
Correct answer Bruce Bullis

What am I doing wrong?

Trusting my example code. 🙂 

In order to create the output path, the sample code changes the timecode string; this means PPro can't understand it when exportFramePNG() is called, so PPro falls back to time 0.

The snippet below works correctly; I'll check it in soon. 

 

	exportCurrentFrameAsPNG : function () {
		app.enableQE();
		var activeSequence = qe.project.getActiveSequence(); // note: make sure a sequence is active in PPro UI
		if (activeSequence) {
			// Create a file name, based on timecode of frame.
			var time = activeSequence.CTI.timecode; // CTI = Current Time Indicator.
			var removeThese = /:|;/ig; 				// Why? Because Windows chokes on colons in file names.
			var tidyTime = time.replace(removeThese, '_');
			var outputPath = new File("~/Desktop");
			var outputFileName = outputPath.fsName + $._PPP_.getSep() + tidyTime + '___' + activeSequence.name;
			activeSequence.exportFramePNG(time, outputFileName);
		} else {
			$._PPP_.updateEventPanel("No active sequence.");
		}
	},

 

 

1 reply

Bruce Bullis
Bruce BullisCorrect answer
Legend
October 27, 2020

What am I doing wrong?

Trusting my example code. 🙂 

In order to create the output path, the sample code changes the timecode string; this means PPro can't understand it when exportFramePNG() is called, so PPro falls back to time 0.

The snippet below works correctly; I'll check it in soon. 

 

	exportCurrentFrameAsPNG : function () {
		app.enableQE();
		var activeSequence = qe.project.getActiveSequence(); // note: make sure a sequence is active in PPro UI
		if (activeSequence) {
			// Create a file name, based on timecode of frame.
			var time = activeSequence.CTI.timecode; // CTI = Current Time Indicator.
			var removeThese = /:|;/ig; 				// Why? Because Windows chokes on colons in file names.
			var tidyTime = time.replace(removeThese, '_');
			var outputPath = new File("~/Desktop");
			var outputFileName = outputPath.fsName + $._PPP_.getSep() + tidyTime + '___' + activeSequence.name;
			activeSequence.exportFramePNG(time, outputFileName);
		} else {
			$._PPP_.updateEventPanel("No active sequence.");
		}
	},

 

 

Anth5E14Author
Participant
October 27, 2020

Thanks, works like a charm!