Skip to content

Commit c5a837c

Browse files
authored
Merge branch 'larymak:main' into main
2 parents 591b9db + c7618f4 commit c5a837c

File tree

17 files changed

+114402
-1
lines changed

17 files changed

+114402
-1
lines changed

CLI-Photo-Watermark/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Usage #
2+
---
3+
4+
- This script is for watermarking an entire directory of images ( .jpgs | .pngs )
5+
- Run the script in the directory that you want to watermark like this:
6+
``python main.py -w [watermark] -p [position] ``
7+
8+
- watermark - The text you want to watermark on the images
9+
- position - ul : upper left , ur - upper right , ll - lower left , lr - lower right
10+
11+
- This will make a folder called 'Watermarked' and copy the new watermarked images into it, preserving original images

CLI-Photo-Watermark/main.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import argparse
2+
import cv2
3+
import os
4+
5+
# Watermark Configuration
6+
font = cv2.FONT_HERSHEY_COMPLEX
7+
color = (255, 255, 255)
8+
thickness = 4
9+
10+
# Setting up the argument parser for CMD Line interface
11+
ap = argparse.ArgumentParser()
12+
ap.add_argument('-f', '--file', required=False,
13+
help='Path to target file')
14+
ap.add_argument('-w', '--watermark', required=True,
15+
help='Text you would like to watermark image with | (Enclose in quotes if there are spaces)')
16+
ap.add_argument('-d', '--directory', required=False,
17+
help='Processes every image in the CWD')
18+
ap.add_argument('-p', '--position', required=True,
19+
help='Options are "ul"(upper left) "ur"(upper right) "ll"(lower left) "lr"(lower right)')
20+
args = ap.parse_args()
21+
print(args)
22+
23+
def process_image(filename, watermark, pos):
24+
"""
25+
:param filename: str
26+
the path of the photo, built from cwd
27+
:param watermark: str
28+
the text you want watermarked on the image
29+
:param pos: str
30+
the position of the watermark ex. "ll" (lower left) | "ur" (upper right)
31+
:return: None
32+
a new folder name "Watermarked" will be made in CWD with finished images
33+
"""
34+
35+
working_image = cv2.imread(filename)
36+
text_length = len(watermark)
37+
if working_image.shape[0] >= 4000:
38+
avg_char = 120
39+
text_width = text_length * avg_char
40+
fontScale = 6
41+
image_ul = (0, 150)
42+
image_ur = (working_image.shape[1] - text_width, 150)
43+
image_ll = (0, working_image.shape[0] - 50)
44+
image_lr = (working_image.shape[1] - text_width, working_image.shape[0] - 50)
45+
else:
46+
avg_char = 80
47+
text_width = text_length * avg_char
48+
fontScale = 3
49+
image_ul = (0, 100)
50+
image_ur = (working_image.shape[1] - text_width, 100)
51+
image_ll = (0, working_image.shape[0] - 50)
52+
image_lr = (working_image.shape[1] - text_width, working_image.shape[0] - 50)
53+
54+
if pos == 'ul':
55+
new_image = cv2.putText(working_image, args.watermark, image_ul, font, fontScale, color, thickness, cv2.LINE_AA)
56+
57+
if pos == 'ur':
58+
new_image = cv2.putText(working_image, args.watermark, image_ur, font, fontScale, color, thickness, cv2.LINE_AA)
59+
60+
if pos == 'll':
61+
new_image = cv2.putText(working_image, args.watermark, image_ll, font, fontScale, color, thickness, cv2.LINE_AA)
62+
63+
if pos == 'lr':
64+
new_image = cv2.putText(working_image, args.watermark, image_lr, font, fontScale, color, thickness, cv2.LINE_AA)
65+
66+
if not os.path.exists(os.getcwd() + '\\Watermarked'):
67+
os.mkdir(os.getcwd() + '\\Watermarked')
68+
69+
path = os.getcwd() + '\\' + 'Watermarked' + '\\' + file
70+
cv2.imwrite(path, new_image)
71+
72+
73+
# Call function on all files in CWD ending with .png or .jpg
74+
for file in os.listdir(os.getcwd()):
75+
if file.endswith('.jpg') or file.endswith('.png'):
76+
process_image(os.getcwd() + '\\' + file, args.watermark, args.position)

CLI-Photo-Watermark/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
opencv-python~=4.5.1.48

CLI-Photo-Watermark/testphoto.jpg

32.7 KB
Loading

CLI-Photo-Watermark/testpng.png

40.3 KB
Loading
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Draw python logo
2+
3+
4+
5+
### Modules required:
6+
```
7+
pip install PythonTurtle
8+
```
9+
10+
### Importing the module
11+
12+
```python
13+
import turtle
14+
```
15+
16+
## Output of this code:
17+
18+
<img src="https://github.com/Dummyjar/Dummyjar/blob/main/InShot_20210822_204315352.gif">

Draw python logo using python/main.py

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
import turtle as t
2+
'''Author: Rajarshi Banerjee | GSAUC3'''
3+
class logo:
4+
5+
def __init__(i,t) -> None:
6+
i.t=t
7+
8+
def blue_part(i):
9+
i.t.penup()
10+
11+
# d = 200
12+
# x = 10
13+
i.t.pencolor('blue')
14+
i.t.color('blue')
15+
i.t.goto(-110,-100)
16+
i.t.pendown()
17+
i.t.begin_fill()
18+
i.t.right(180)
19+
i.t.forward(100/3)
20+
21+
for _ in range(5):
22+
i.t.right(15)
23+
i.t.forward(15)
24+
i.t.forward(15)
25+
i.t.right(5)
26+
for _ in range(5):
27+
i.t.forward(15)
28+
i.t.right(5)
29+
i.t.forward(27.58789)
30+
for _ in range(5):
31+
i.t.right(15)
32+
i.t.forward(15)
33+
34+
35+
36+
i.t.goto(0,100)
37+
i.t.goto(0,110)
38+
i.t.goto(-100,110)
39+
i.t.goto(-100,110+100/3)
40+
i.t.left(90)
41+
42+
for _ in range(5):
43+
i.t.right(15)
44+
i.t.forward(15)
45+
i.t.forward(15)
46+
i.t.right(5)
47+
for _ in range(5):
48+
i.t.forward(15)
49+
i.t.right(5)
50+
i.t.forward(27.58789)
51+
for _ in range(5):
52+
i.t.right(15)
53+
i.t.forward(15)
54+
55+
i.t.forward(60+10)
56+
57+
58+
for _ in range(5):
59+
i.t.right(15)
60+
i.t.forward(15)
61+
62+
i.t.right(5)
63+
i.t.goto(-100+30,10)
64+
65+
66+
for _ in range(5):
67+
i.t.left(15)
68+
i.t.forward(15)
69+
i.t.left(5)
70+
71+
i.t.goto(-110,-100)
72+
i.t.end_fill()
73+
74+
def yellow_part(i):
75+
i.t.penup()
76+
i.t.pencolor('yellow')
77+
i.t.color('yellow')
78+
i.t.goto(110,100)
79+
i.t.right(90)
80+
i.t.pendown()
81+
i.t.begin_fill()
82+
i.t.right(180)
83+
i.t.forward(100/3)
84+
85+
for _ in range(5):
86+
i.t.right(15)
87+
i.t.forward(15)
88+
i.t.forward(15)
89+
i.t.right(5)
90+
for _ in range(5):
91+
i.t.forward(15)
92+
i.t.right(5)
93+
i.t.forward(27.58789)
94+
for _ in range(5):
95+
i.t.right(15)
96+
i.t.forward(15)
97+
98+
99+
100+
i.t.goto(0,-100)
101+
i.t.goto(0,-110)
102+
i.t.goto(100,-110)
103+
i.t.goto(100,-110-100/3)
104+
i.t.left(90)
105+
106+
for _ in range(5):
107+
i.t.right(15)
108+
i.t.forward(15)
109+
i.t.forward(15)
110+
i.t.right(5)
111+
for _ in range(5):
112+
i.t.forward(15)
113+
i.t.right(5)
114+
i.t.forward(27.58789)
115+
for _ in range(5):
116+
i.t.right(15)
117+
i.t.forward(15)
118+
119+
i.t.forward(60+10)
120+
121+
122+
for _ in range(5):
123+
i.t.right(15)
124+
i.t.forward(15)
125+
126+
i.t.right(5)
127+
i.t.goto(70,-10)
128+
129+
130+
for _ in range(5):
131+
i.t.left(15)
132+
i.t.forward(15)
133+
i.t.left(5)
134+
135+
i.t.goto(110,100)
136+
i.t.end_fill()
137+
138+
139+
def eyes(i):
140+
i.t.penup()
141+
i.t.color('white')
142+
i.t.goto(-70,130)
143+
i.t.pendown()
144+
i.t.begin_fill()
145+
i.t.circle(10)
146+
i.t.end_fill()
147+
148+
i.t.penup()
149+
i.t.color('white')
150+
i.t.goto(70+20,-130)
151+
i.t.pendown()
152+
i.t.begin_fill()
153+
i.t.circle(10)
154+
i.t.end_fill()
155+
156+
i.t.hideturtle()
157+
158+
159+
160+
if __name__ =="__main__":
161+
t.Turtle()
162+
obj=logo(t)
163+
obj.blue_part()
164+
obj.yellow_part()
165+
obj.eyes()
166+
t.done()
167+

FastRun/GUI.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
from PySimpleGUI.PySimpleGUI import Button
2+
from configurer import create_config
3+
from tkinter.constants import CENTER
4+
import PySimpleGUI as sg
5+
6+
choose = [
7+
[
8+
sg.Button("Add"),
9+
sg.In(size=(25, 1), key="app")
10+
],
11+
[
12+
sg.Text("or")
13+
],
14+
[
15+
sg.FileBrowse("Choose application", enable_events=True, key="chooseApp"),
16+
]
17+
]
18+
19+
layout = [
20+
[
21+
sg.Text("FastRun", justification=CENTER, size=(50,2)),
22+
],
23+
[
24+
sg.Text("Name"),
25+
sg.In(size=(25, 1), default_text="main",enable_events=True, key="name"),
26+
],
27+
[
28+
sg.Text("Number of screen"),
29+
sg.In(size=(5, 1),enable_events=True, key="nScreen"),
30+
],
31+
choose,
32+
[
33+
sg.Listbox(values=[], enable_events=True, size=(50, 10), key="appList")
34+
],
35+
[
36+
sg.Button("Submit")
37+
]
38+
]
39+
40+
window = sg.Window("FastRun", layout)
41+
42+
Name = "main"
43+
nScreen = 1
44+
AppList = []
45+
46+
while True:
47+
event, values = window.read()
48+
if event == sg.WIN_CLOSED:
49+
break
50+
elif event == "Submit" :
51+
create_config(AppList, nScreen, Name)
52+
break
53+
54+
elif event == "name":
55+
Name = values["name"]
56+
57+
elif event == "nScreen":
58+
try:
59+
nScreen = int(values["nScreen"])
60+
except:
61+
pass
62+
63+
elif event == "chooseApp":
64+
app = values["chooseApp"]
65+
if(app.strip() != ""):
66+
AppList.append(app)
67+
window["appList"].update(AppList)
68+
69+
elif event == "Add":
70+
app = values["app"]
71+
if(app.strip() != ""):
72+
AppList.append(app)
73+
window["appList"].update(AppList)
74+
window["app"].update("")
75+
76+
window.close()

FastRun/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# FastRun
2+
3+
FastRun is a script to create a routine to launch several applications on the different Windows desktops with a single click.
4+
5+
## Instalation
6+
* ``` bash
7+
pip install pysimplegui
8+
```
9+
## Execution
10+
Click on GUI.py to lauch the interface
11+
12+
## Use
13+
14+
1. Choose a name for your routine
15+
2. Give your number of desktop
16+
3. Add an url to open like "www.google.com" or Choose an application to open.
17+
4. Submit your choices. Now there is a shortcut on your desktop to lauch your new routine.

FastRun/VirtualDesktopAccessor.dll

30 KB
Binary file not shown.

0 commit comments

Comments
 (0)