1
1
# !/usr/bin/env python3
2
2
3
- __version__ = "0.9.2 "
3
+ __version__ = "0.9.3 "
4
4
5
5
import argparse , io , os , json , csv , glob , hashlib , warnings , base64 , random , math
6
6
from sklearn .base import BaseEstimator , TransformerMixin
@@ -22,6 +22,23 @@ def list_json_files():
22
22
def list_html_files ():
23
23
return [f for f in os .listdir () if f .endswith ('.html' )]
24
24
25
+ def generate_png (file_path , png_width , png_height ):
26
+ from PIL import Image
27
+ image = Image .new ("RGBA" , (png_width , png_height ), (0 , 0 , 0 , 0 ))
28
+ image .save (file_path )
29
+
30
+ def create_png ():
31
+ png_width = input ("Please provide the width in pixel (i.e., 1024): " )
32
+ png_height = input ("Please provide the height in pixel (i.e., 768): " )
33
+ ask = input ("Enter another file name instead of output (Y/n)? " )
34
+ if ask .lower () == 'y' :
35
+ given = input ("Give a name to the output file: " )
36
+ file_path = given + ".png"
37
+ else :
38
+ file_path = "output.png"
39
+ generate_png (file_path , int (png_width ), int (png_height ))
40
+ print (f"PNG file generated at: { file_path } " )
41
+
25
42
def minify_html (html_content ):
26
43
import re
27
44
html_content = re .sub (r'<!--.*?-->' , '' , html_content , flags = re .DOTALL )
@@ -3505,6 +3522,7 @@ def __init__():
3505
3522
subparsers .add_parser ('minify' , help = 'minify js' )
3506
3523
subparsers .add_parser ('mj' , help = 'minify json' )
3507
3524
subparsers .add_parser ('mh' , help = 'minify html' )
3525
+ subparsers .add_parser ('png' , help = 'create transparent png' )
3508
3526
subparsers .add_parser ('cut' , help = 'cut timestamp' )
3509
3527
subparsers .add_parser ('glue' , help = 'glue timestamp' )
3510
3528
subparsers .add_parser ('code' , help = 'encode or decode' )
@@ -3554,6 +3572,8 @@ def __init__():
3554
3572
base64codeHandler ()
3555
3573
elif args .subcommand == 'json' :
3556
3574
json_merger ()
3575
+ elif args .subcommand == 'png' :
3576
+ create_png ()
3557
3577
elif args .subcommand == 'cut' :
3558
3578
timestamp_cutter ()
3559
3579
elif args .subcommand == 'glue' :
0 commit comments