diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2020-03-10 23:43:12 +0530 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2020-03-10 23:43:12 +0530 |
commit | 862b0783d731dd8980698fb035b78300703b9076 (patch) | |
tree | 80aa5d99be0fc870ac1e64410b8784c3a23fffd4 /src/VHSImage.py | |
parent | fb7991d856fa615a8498b24679e41d82688c347e (diff) |
Added video generator
Diffstat (limited to 'src/VHSImage.py')
-rw-r--r-- | src/VHSImage.py | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/src/VHSImage.py b/src/VHSImage.py index 51688b1..81f446d 100644 --- a/src/VHSImage.py +++ b/src/VHSImage.py @@ -146,25 +146,39 @@ if __name__ == "__main__": build_background("bkg.jpg", 25) """ -def generateVHSStyle(infile, outfile): - cut_rows = bool(random.getrandbits(1)) - offset = random.choice([0,5,10,15,20,25]) - logger.info("Saturating the image") - offset_hue(infile,"saturated.jpg") - if cut_rows: - logger.info("Shifting the image") - mod_image_repeat_rows("saturated.jpg", 0.012, 50, 10, True, "shifted.jpg") +def generateVHSStyle(infile, outfile, silence=False): + if silence: + cut_rows = bool(random.getrandbits(1)) + offset = random.choice([0,5,10,15,20,25]) + offset_hue(infile,"saturated.jpg") + if cut_rows: + mod_image_repeat_rows("saturated.jpg", 0.012, 50, 10, True, "shifted.jpg") + else: + mod_image_repeat_rows("saturated.jpg", 0, 0, 0, True, "shifted.jpg") + add_date("shifted.jpg","noisy.jpg") + add_date("noisy.jpg",outfile, bottom_offset=offset) + os.remove("shifted.jpg") + os.remove("saturated.jpg") + os.remove("noisy.jpg") else: - logger.info("Not applying lines effect") - mod_image_repeat_rows("saturated.jpg", 0, 0, 0, True, "shifted.jpg") - logger.info("Adding noise") - add_date("shifted.jpg","noisy.jpg") - logger.info("Adding text") - add_date("noisy.jpg",outfile, bottom_offset=offset) - logger.info("Generated Image: out.jpg") - logger.info("Removing residual files") - os.remove("shifted.jpg") - os.remove("saturated.jpg") - os.remove("noisy.jpg") + cut_rows = bool(random.getrandbits(1)) + offset = random.choice([0,5,10,15,20,25]) + logger.info("Saturating the image") + offset_hue(infile,"saturated.jpg") + if cut_rows: + logger.info("Shifting the image") + mod_image_repeat_rows("saturated.jpg", 0.012, 50, 10, True, "shifted.jpg") + else: + logger.info("Not applying lines effect") + mod_image_repeat_rows("saturated.jpg", 0, 0, 0, True, "shifted.jpg") + logger.info("Adding noise") + add_date("shifted.jpg","noisy.jpg") + logger.info("Adding text") + add_date("noisy.jpg",outfile, bottom_offset=offset) + logger.info("Generated Image: out.jpg") + logger.info("Removing residual files") + os.remove("shifted.jpg") + os.remove("saturated.jpg") + os.remove("noisy.jpg") #generateVHSStyle("s.jpg","o.jpg")
\ No newline at end of file |