Filter SDK/Change frame size

From Avisynth wiki
Jump to: navigation, search

The following example code shows how to double the width of the destination frame:

	ShowPixelValues(PClip _child, IScriptEnvironment* env) :
	// constructor code	

	vi.width = vi.width*2; // width is doubled here
	vi.height = vi.height*2;  // height is also multiplied by 2
   PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env);

PVideoFrame __stdcall ShowPixelValues::GetFrame(int n, IScriptEnvironment* env) {

		PVideoFrame src = child->GetFrame(n, env);
		PVideoFrame dst = env->NewVideoFrame(vi); // new frame is double the size of src

A similar approach has to be used for changing colorspace, framerate etc. There is a bit more information at Working with images.

Personal tools