How to use the vapoursynth.core.imwri.Write 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
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)
		#Don't bother converting if previewing is disabled
		if nopreview:
			return clip
		if not key[4]:
			alphaclip = None
			origalpha = None
		return previewfunc(clip, alphaclip, original, origalpha)
github AlphaAtlas / VapourSynth-Super-Resolution-Helper / CustomScripts / HelperScripts / ImageFetcher.py View on Github external
def Writer(clip, iformat, oformat, ifolder, filelist, comp = "DXT5", alpha = False, q = 100, alphaclip = None, ):
	#Writes images to an output folder. Upscales the alpha channel if necessary. 
	if alpha == True:
		while clip.width > alphaclip.width:
			alphaclip = core.nnedi3cl.NNEDI3CL(alphaclip, field = 0, dh = True, dw = True, qual = 2)
		if (clip.width != alphaclip.width) or (clip.height != alphaclip.height):
			alphaclip = muf.SSIM_downsample(alphaclip, clip.width, clip.height)
		clip = core.imwri.Write(clip, imgformat = oformat.upper(), filename = ifolder + r"/../VapourSynth_Image_Buffer/image%d."  + oformat, firstnum = 0, quality = q, overwrite=True, alpha = alphaclip)
	else:
		clip = core.imwri.Write(clip, imgformat = oformat.upper(), filename = ifolder + r"/../VapourSynth_Image_Buffer/image%d."  + oformat, firstnum = 0, quality = q, overwrite=True)
#	clip = core.std.FrameEval(clip, functools.partial(saver, clip=clip, ImageFolder = ifolder, OutputFormat = oformat, filelist = filelist, iformat = iformat))
	return clip
github AlphaAtlas / VapourSynth-Super-Resolution-Helper / Scripts / Alpha_ImageHelper.py View on Github external
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)
		#Don't bother converting if previewing is disabled
		if nopreview:
			return clip
		if not key[4]:
			alphaclip = None
			origalpha = None
		return previewfunc(clip, alphaclip, original, origalpha)
github AlphaAtlas / VapourSynth-Super-Resolution-Helper / CustomScripts / HelperScripts / ImageFetcher.py View on Github external
def Writer(clip, iformat, oformat, ifolder, filelist, comp = "DXT5", alpha = False, q = 100, alphaclip = None, ):
	#Writes images to an output folder. Upscales the alpha channel if necessary. 
	if alpha == True:
		while clip.width > alphaclip.width:
			alphaclip = core.nnedi3cl.NNEDI3CL(alphaclip, field = 0, dh = True, dw = True, qual = 2)
		if (clip.width != alphaclip.width) or (clip.height != alphaclip.height):
			alphaclip = muf.SSIM_downsample(alphaclip, clip.width, clip.height)
		clip = core.imwri.Write(clip, imgformat = oformat.upper(), filename = ifolder + r"/../VapourSynth_Image_Buffer/image%d."  + oformat, firstnum = 0, quality = q, overwrite=True, alpha = alphaclip)
	else:
		clip = core.imwri.Write(clip, imgformat = oformat.upper(), filename = ifolder + r"/../VapourSynth_Image_Buffer/image%d."  + oformat, firstnum = 0, quality = q, overwrite=True)
#	clip = core.std.FrameEval(clip, functools.partial(saver, clip=clip, ImageFolder = ifolder, OutputFormat = oformat, filelist = filelist, iformat = iformat))
	return clip