Skip to content

Commit 0f9bb53

Browse files
authored
Update rjj.py
1 parent 141a405 commit 0f9bb53

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

rjj.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# !/usr/bin/env python3
22

3-
__version__="0.9.2"
3+
__version__="0.9.3"
44

55
import argparse, io, os, json, csv, glob, hashlib, warnings, base64, random, math
66
from sklearn.base import BaseEstimator, TransformerMixin
@@ -22,6 +22,23 @@ def list_json_files():
2222
def list_html_files():
2323
return [f for f in os.listdir() if f.endswith('.html')]
2424

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+
2542
def minify_html(html_content):
2643
import re
2744
html_content = re.sub(r'<!--.*?-->', '', html_content, flags=re.DOTALL)
@@ -3505,6 +3522,7 @@ def __init__():
35053522
subparsers.add_parser('minify', help='minify js')
35063523
subparsers.add_parser('mj', help='minify json')
35073524
subparsers.add_parser('mh', help='minify html')
3525+
subparsers.add_parser('png', help='create transparent png')
35083526
subparsers.add_parser('cut', help='cut timestamp')
35093527
subparsers.add_parser('glue', help='glue timestamp')
35103528
subparsers.add_parser('code', help='encode or decode')
@@ -3554,6 +3572,8 @@ def __init__():
35543572
base64codeHandler()
35553573
elif args.subcommand == 'json':
35563574
json_merger()
3575+
elif args.subcommand == 'png':
3576+
create_png()
35573577
elif args.subcommand == 'cut':
35583578
timestamp_cutter()
35593579
elif args.subcommand == 'glue':

0 commit comments

Comments
 (0)