How to use the vapoursynth.core.imwri.Read function in VapourSynth

To help you get started, we’ve selected a few VapourSynth examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AlphaAtlas / VapourSynth-Super-Resolution-Helper / Scripts / Alpha_ImageHelper.py View on Github external
def Processor(key, sizeformatdict, start):
		#Writes the images, and does all the processing from the .vpy script
		#This function expects clips to have a constant format/size!
		clip = None
		alphaclip = None
		if key[4]:
			clip, alphaclip = core.imwri.Read(sizeformatdict[key], mismatch=False, alpha=True)
		else:
			clip = core.imwri.Read(sizeformatdict[key], mismatch=False, alpha=False)
		clip = core.std.AssumeFPS(clip, fpsnum=1)
		original = clip
		clip = func(clip)
		if key[4]:
			alphaclip = core.std.AssumeFPS(alphaclip, fpsnum=1)
			origalpha = alphaclip
			alphaclip = alphafunc(alphaclip)
			#Defaults to resizing the alpha layer to the color clip size. 
			#Technically optional, but I'm not sure IMWRI supports a format where the alpha is smaller than the image.  
			if ((clip.width, clip.height) != (alphaclip.width, alphaclip.height)) and scalealpha:
				alphaclip = core.resize.Spline36(alphaclip, clip.width, clip.height)
		if writeimages:
			if key[4]:
				clip = core.imwri.Write(clip, imgformat = imgformat, filename = os.path.join(tempdir, r"%d." + imgformat ), firstnum = start, quality = quality, overwrite=True, compression_type = compression_type, alpha = alphaclip)
github AlphaAtlas / VapourSynth-Super-Resolution-Helper / CustomScripts / HelperScripts / ImageFetcher.py View on Github external
def GetClip(filelist, balpha, mis = False):
	#Returns a VapourSynth clip and alpha clip containing images from filelist
	#Clips need to be spliced together like this to support images with multiple resolutions
	if balpha == True:
		clip, alphaclip =  core.imwri.Read(filelist[0], mismatch=False, alpha=True)
		if len(filelist) > 1:
			filelist = filelist[1:]
			for file in filelist:
				singleclip, singlealphaclip = core.imwri.Read(file, mismatch=False, alpha=True)
				clip = core.std.Splice([clip, singleclip], mismatch = mis)
				alphaclip = core.std.Splice([alphaclip, singlealphaclip], mismatch = mis)
		return clip, alphaclip
	else:
		clip =  core.imwri.Read(filelist[0], mismatch=False, alpha=False)
		if len(filelist) > 1:
			filelist = filelist[1:]
			for file in filelist:
				singleclip = core.imwri.Read(file, mismatch=False, alpha=False)
				clip = core.std.Splice([clip, singleclip], mismatch = mis)
		return clip, core.std.BlankClip(clip, length = clip.num_frames)
github AlphaAtlas / VapourSynth-Super-Resolution-Helper / Scripts / Alpha_ImageHelper.py View on Github external
def Processor(key, sizeformatdict, start):
		#Writes the images, and does all the processing from the .vpy script
		#This function expects clips to have a constant format/size!
		clip = None
		alphaclip = None
		if key[4]:
			clip, alphaclip = core.imwri.Read(sizeformatdict[key], mismatch=False, alpha=True)
		else:
			clip = core.imwri.Read(sizeformatdict[key], mismatch=False, alpha=False)
		clip = core.std.AssumeFPS(clip, fpsnum=1)
		original = clip
		clip = func(clip)
		if key[4]:
			alphaclip = core.std.AssumeFPS(alphaclip, fpsnum=1)
			origalpha = alphaclip
			alphaclip = alphafunc(alphaclip)
			#Defaults to resizing the alpha layer to the color clip size. 
			#Technically optional, but I'm not sure IMWRI supports a format where the alpha is smaller than the image.  
			if ((clip.width, clip.height) != (alphaclip.width, alphaclip.height)) and scalealpha:
				alphaclip = core.resize.Spline36(alphaclip, clip.width, clip.height)
		if writeimages:
			if key[4]:
				clip = core.imwri.Write(clip, imgformat = imgformat, filename = os.path.join(tempdir, r"%d." + imgformat ), firstnum = start, quality = quality, overwrite=True, compression_type = compression_type, alpha = alphaclip)
			else:
				clip = core.imwri.Write(clip, imgformat = imgformat, filename = os.path.join(tempdir, r"%d." + imgformat ), firstnum = start, quality = quality, overwrite=True, compression_type = compression_type)
github AlphaAtlas / VapourSynth-Super-Resolution-Helper / CustomScripts / HelperScripts / ImageFetcher.py View on Github external
def GetClip(filelist, balpha, mis = False):
	#Returns a VapourSynth clip and alpha clip containing images from filelist
	#Clips need to be spliced together like this to support images with multiple resolutions
	if balpha == True:
		clip, alphaclip =  core.imwri.Read(filelist[0], mismatch=False, alpha=True)
		if len(filelist) > 1:
			filelist = filelist[1:]
			for file in filelist:
				singleclip, singlealphaclip = core.imwri.Read(file, mismatch=False, alpha=True)
				clip = core.std.Splice([clip, singleclip], mismatch = mis)
				alphaclip = core.std.Splice([alphaclip, singlealphaclip], mismatch = mis)
		return clip, alphaclip
	else:
		clip =  core.imwri.Read(filelist[0], mismatch=False, alpha=False)
		if len(filelist) > 1:
			filelist = filelist[1:]
			for file in filelist:
				singleclip = core.imwri.Read(file, mismatch=False, alpha=False)
				clip = core.std.Splice([clip, singleclip], mismatch = mis)
		return clip, core.std.BlankClip(clip, length = clip.num_frames)
github AlphaAtlas / VapourSynth-Super-Resolution-Helper / CustomScripts / HelperScripts / ImageFetcher.py View on Github external
#Clips need to be spliced together like this to support images with multiple resolutions
	if balpha == True:
		clip, alphaclip =  core.imwri.Read(filelist[0], mismatch=False, alpha=True)
		if len(filelist) > 1:
			filelist = filelist[1:]
			for file in filelist:
				singleclip, singlealphaclip = core.imwri.Read(file, mismatch=False, alpha=True)
				clip = core.std.Splice([clip, singleclip], mismatch = mis)
				alphaclip = core.std.Splice([alphaclip, singlealphaclip], mismatch = mis)
		return clip, alphaclip
	else:
		clip =  core.imwri.Read(filelist[0], mismatch=False, alpha=False)
		if len(filelist) > 1:
			filelist = filelist[1:]
			for file in filelist:
				singleclip = core.imwri.Read(file, mismatch=False, alpha=False)
				clip = core.std.Splice([clip, singleclip], mismatch = mis)
		return clip, core.std.BlankClip(clip, length = clip.num_frames)
github AlphaAtlas / VapourSynth-Super-Resolution-Helper / CustomScripts / HelperScripts / ImageFetcher.py View on Github external
def GetClip(filelist, balpha, mis = False):
	#Returns a VapourSynth clip and alpha clip containing images from filelist
	#Clips need to be spliced together like this to support images with multiple resolutions
	if balpha == True:
		clip, alphaclip =  core.imwri.Read(filelist[0], mismatch=False, alpha=True)
		if len(filelist) > 1:
			filelist = filelist[1:]
			for file in filelist:
				singleclip, singlealphaclip = core.imwri.Read(file, mismatch=False, alpha=True)
				clip = core.std.Splice([clip, singleclip], mismatch = mis)
				alphaclip = core.std.Splice([alphaclip, singlealphaclip], mismatch = mis)
		return clip, alphaclip
	else:
		clip =  core.imwri.Read(filelist[0], mismatch=False, alpha=False)
		if len(filelist) > 1:
			filelist = filelist[1:]
			for file in filelist:
				singleclip = core.imwri.Read(file, mismatch=False, alpha=False)
				clip = core.std.Splice([clip, singleclip], mismatch = mis)
		return clip, core.std.BlankClip(clip, length = clip.num_frames)