-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
615 lines (593 loc) · 43.5 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
from PyQt5 import QtCore, QtGui, QtWidgets
import display
from cv2 import imread, imwrite, resize
import numpy as np
import os
import sys
from PIL import Image
from random import randint
# variables
img = ''
width, height = 0, 0
img_0 = ''
img_1 = ''
final_width, final_height = 0, 0
final_img = ''
main_color = (0, 0, 0)
bg_color = (255, 255, 255)
ress = []
# end
class Ui_MainWindow(QtWidgets.QMainWindow):
def display(self):
global final_img
if display.onScreen:
self.ui.close()
self.ui = display.Ui_DisplayWindow()
self.ui.setupUi(final_img, icon)
self.ui.show()
def closeEvent(self, event):
if display.onScreen:
self.ui.quitt()
event.accept()
def setupUi(self):
global icon
self.setObjectName("self")
self.setFixedSize(483, 351)
self.setIconSize(QtCore.QSize(24, 24))
self.setWindowIcon(icon)
self.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)
self.setAnimated(True)
self.mainwindow = self
self.centralwidget = QtWidgets.QWidget(self)
self.centralwidget.setObjectName("centralwidget")
self.edt_browse = QtWidgets.QLineEdit(self.centralwidget)
self.edt_browse.setGeometry(QtCore.QRect(20, 30, 321, 20))
self.edt_browse.setInputMask("")
self.edt_browse.setObjectName("edt_browse")
self.btn_browse = QtWidgets.QPushButton(self.centralwidget)
self.btn_browse.setGeometry(QtCore.QRect(360, 15, 75, 23))
self.btn_browse.setObjectName("btn_browse")
self.btn_save = QtWidgets.QPushButton(self.centralwidget)
self.btn_save.setGeometry(QtCore.QRect(360, 43, 75, 23))
self.btn_save.setObjectName("btn_save")
self.progressBar = QtWidgets.QProgressBar(self.centralwidget)
self.progressBar.setGeometry(QtCore.QRect(10, 250, 471, 23))
self.progressBar.setProperty("value", 24)
self.progressBar.setObjectName("progressBar")
self.progressBar.setValue(0)
self.btn_display = QtWidgets.QPushButton(self.centralwidget)
self.btn_display.setGeometry(QtCore.QRect(200, 195, 81, 23))
self.btn_display.setObjectName("btn_display")
self.btn_progress = QtWidgets.QPushButton(self.centralwidget)
self.btn_progress.setGeometry(QtCore.QRect(200, 220, 81, 23))
self.btn_progress.setObjectName("btn_progress")
self.lb_Done = QtWidgets.QLabel(self.centralwidget)
self.lb_Done.setEnabled(True)
self.lb_Done.setGeometry(QtCore.QRect(210, 280, 61, 21))
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.lb_Done.setFont(font)
self.lb_Done.setAlignment(QtCore.Qt.AlignCenter)
self.lb_Done.setObjectName("lb_Done")
self.spinBox = QtWidgets.QSpinBox(self.centralwidget)
self.spinBox.setGeometry(QtCore.QRect(80, 80, 42, 22))
self.spinBox.setObjectName("spinBox")
self.spinBox.setMinimum(1)
self.spinBox.setValue(8)
self.spinBox_2 = QtWidgets.QSpinBox(self.centralwidget)
self.spinBox_2.setGeometry(QtCore.QRect(80, 110, 42, 22))
self.spinBox_2.setObjectName("spinBox_2")
self.spinBox_2.setMinimum(1)
self.spinBox_2.setValue(13)
self.lb_width = QtWidgets.QLabel(self.centralwidget)
self.lb_width.setGeometry(QtCore.QRect(20, 80, 47, 16))
self.lb_width.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.lb_width.setObjectName("lb_width")
self.lb_height = QtWidgets.QLabel(self.centralwidget)
self.lb_height.setGeometry(QtCore.QRect(20, 110, 47, 16))
self.lb_height.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.lb_height.setObjectName("lb_height")
self.label_3 = QtWidgets.QLabel(self.centralwidget)
self.label_3.setGeometry(QtCore.QRect(160, 90, 200, 31))
self.label_3.setObjectName("label_3")
self.comboBox = QtWidgets.QComboBox(self.centralwidget)
self.comboBox.setGeometry(QtCore.QRect(360, 100, 81, 21))
font = QtGui.QFont()
font.setBold(False)
font.setWeight(50)
self.comboBox.setFont(font)
self.comboBox.setObjectName("comboBox")
for _ in ress:
self.comboBox.addItem('')
self.checkBox1 = QtWidgets.QCheckBox(self.centralwidget)
self.checkBox1.setGeometry(QtCore.QRect(30, 140, 70, 17))
self.checkBox1.setObjectName('CheckBoxF')
self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
self.checkBox.setGeometry(QtCore.QRect(30, 160, 70, 17))
self.checkBox.setObjectName("checkBox")
self.checkBox_r = QtWidgets.QCheckBox(self.centralwidget)
self.checkBox_r.setGeometry(QtCore.QRect(30, 180, 70, 17))
self.checkBox_r.setObjectName("checkBoxr")
self.checkbox2 = QtWidgets.QCheckBox(self.centralwidget)
self.checkbox2.setGeometry(QtCore.QRect(375, 140, 70, 17))
self.checkbox2.setObjectName('CheckBoxFi')
self.checkbox3 = QtWidgets.QCheckBox(self.centralwidget)
self.checkbox3.setGeometry(QtCore.QRect(375, 160, 70, 17))
self.checkbox3.setObjectName('CheckBoxC')
self.checkbox4 = QtWidgets.QCheckBox(self.centralwidget)
self.checkbox4.setGeometry(QtCore.QRect(375, 180, 70, 17))
self.checkbox4.setObjectName('CheckboxRcolor')
self.checkbox5 = QtWidgets.QCheckBox(self.centralwidget)
self.checkbox5.setGeometry(QtCore.QRect(375, 200, 70, 17))
self.checkbox5.setObjectName('CheckRand')
self.sens = QtWidgets.QDoubleSpinBox(self.centralwidget)
self.sens.setGeometry(QtCore.QRect(75, 209, 42, 22))
self.sens.setMinimum(0)
self.sens.setMaximum(1)
self.sens.setValue(0.5)
self.sens.setSingleStep(0.1)
self.lb_sens = QtWidgets.QLabel(self.centralwidget)
self.lb_sens.setGeometry(QtCore.QRect(30, 210, 40, 17))
self.lb_sens.setText('Sens :')
self.lb_sens.adjustSize()
self.btn_bgcolor = QtWidgets.QPushButton(self.centralwidget)
self.btn_bgcolor.setGeometry(QtCore.QRect(140, 160, 75, 23))
self.btn_bgcolor.setObjectName("btn_bgcolor")
self.btn_maincolor = QtWidgets.QPushButton(self.centralwidget)
self.btn_maincolor.setGeometry(QtCore.QRect(280, 160, 81, 23))
self.btn_maincolor.setObjectName("btn_maincolor")
self.clr_bg = QtWidgets.QLabel(self.centralwidget)
self.clr_bg.setEnabled(True)
self.clr_bg.setGeometry(QtCore.QRect(117, 163, 16, 16))
self.clr_bg.setAutoFillBackground(False)
self.clr_bg.setText("")
self.clr_bg.setObjectName("clr_bg")
self.clr_bg.setStyleSheet('background-color: #fff')
self.clr_main = QtWidgets.QLabel(self.centralwidget)
self.clr_main.setGeometry(QtCore.QRect(260, 163, 16, 16))
self.clr_main.setText("")
self.clr_main.setObjectName("clr_main")
self.clr_main.setStyleSheet('background-color: #000')
self.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(self)
self.menubar.setGeometry(QtCore.QRect(0, 0, 483, 21))
self.menubar.setObjectName("menubar")
self.menuFile = QtWidgets.QMenu(self.menubar)
self.menuFile.setObjectName("menuFile")
self.menuHelp = QtWidgets.QMenu(self.menubar)
self.menuHelp.setObjectName("menuHelp")
self.setMenuBar(self.menubar)
# self.statusbar = QtWidgets.QStatusBar(self)
# self.statusbar.setObjectName("statusbar")
# self.setStatusBar(self.statusbar)
self.actionOpen = QtWidgets.QAction(self)
self.actionOpen.setObjectName("actionOpen")
self.actionSave = QtWidgets.QAction(self)
self.actionSave.setObjectName("actionSave")
self.actionExit = QtWidgets.QAction(self)
self.actionExit.setObjectName("actionExit")
self.actionAbout = QtWidgets.QAction(self)
self.actionAbout.setObjectName("actionAbout")
self.menuFile.addAction(self.actionOpen)
self.menuFile.addAction(self.actionSave)
self.menuFile.addAction(self.actionExit)
self.menuHelp.addAction(self.actionAbout)
self.menubar.addAction(self.menuFile.menuAction())
self.menubar.addAction(self.menuHelp.menuAction())
self.retranslateUi()
QtCore.QMetaObject.connectSlotsByName(self)
def retranslateUi(self):
_translate = QtCore.QCoreApplication.translate
self.setWindowTitle(_translate("self", "Binary Image"))
self.spinBox.valueChanged.connect(self.spinbox_value_changed)
self.spinBox_2.valueChanged.connect(self.spinbox_value_changed)
self.edt_browse.setText(_translate("self", "Choose Your Image..."))
self.btn_browse.setText(_translate("self", "Browse"))
self.btn_browse.adjustSize()
self.btn_browse.clicked.connect(self.btn_browse_clicked)
self.btn_save.setText(_translate("self", "Save"))
self.btn_save.adjustSize()
self.btn_save.clicked.connect(self.btn_save_clicked)
self.btn_progress.setText(_translate("self", "Progress"))
self.btn_progress.adjustSize()
self.btn_progress.clicked.connect(self.btn_progress_clicked)
self.btn_display.setText(_translate("self", "Display"))
self.btn_display.adjustSize()
self.btn_display.clicked.connect(self.display)
self.lb_Done.setText(_translate("self", ""))
self.lb_width.setText(_translate("self", "Width : "))
self.lb_width.adjustSize()
self.lb_height.setText(_translate("self", "Height : "))
self.lb_height.adjustSize()
self.label_3.setText(_translate("self", "Final Image size : ? x ?"))
self.label_3.adjustSize()
for l in range(len(ress)):
self.comboBox.setItemText(l, _translate("self", ress[l]))
self.checkBox.setText(_translate("self", "Gradient"))
self.checkBox.adjustSize()
self.checkBox.clicked.connect(self.num_col)
self.checkBox_r.setText(_translate("self", "Reverse"))
self.checkBox_r.adjustSize()
self.checkBox1.setText(_translate("self", "Fill bg"))
self.checkBox1.adjustSize()
self.checkBox1.clicked.connect(self.fill_change)
self.checkbox2.setText(_translate("self", "Fill Nums"))
self.checkbox2.adjustSize()
self.checkbox2.clicked.connect(self.num_col2)
self.checkbox3.setText(_translate("self", "RGB pic"))
self.checkbox3.adjustSize()
self.checkbox4.setText(_translate("self", "Reverse Colors"))
self.checkbox4.adjustSize()
self.checkbox4.setEnabled(False)
self.checkbox5.setText(_translate('self', 'Random Numbers'))
self.checkbox5.adjustSize()
self.checkbox5.setEnabled(False)
self.checkbox5.clicked.connect(self.rand_click)
self.btn_bgcolor.setText(_translate("self", "Pick bg color"))
self.btn_bgcolor.adjustSize()
self.btn_bgcolor.clicked.connect(self.color_pick_bg)
self.btn_maincolor.setText(_translate("self", "Pick main color"))
self.btn_maincolor.adjustSize()
self.btn_maincolor.clicked.connect(self.color_pick_main)
self.menuFile.setTitle(_translate("self", "File"))
self.menuHelp.setTitle(_translate("self", "Help"))
self.actionOpen.setText(_translate("self", "Browse"))
self.actionOpen.triggered.connect(self.btn_browse_clicked)
self.actionSave.setText(_translate("self", "Save"))
self.actionSave.triggered.connect(self.btn_save_clicked)
self.actionExit.setText(_translate("self", "Exit"))
self.actionExit.triggered.connect(sys.exit)
self.actionAbout.setText(_translate("self", "About"))
self.actionAbout.triggered.connect(self.show_about)
self.adjustSize()
self.show()
def rand_click(self):
if self.checkbox5.isChecked():
self.checkBox_r.setChecked(False)
self.checkBox_r.setEnabled(False)
self.sens.setEnabled(False)
self.lb_sens.setEnabled(False)
else:
self.checkBox_r.setEnabled(True)
self.sens.setEnabled(True)
self.lb_sens.setEnabled(True)
def spinbox_value_changed(self):
global final_width, final_height
final_width, final_height = self.standard_Image_Size()
self.display_img_size()
def num_col(self):
if any([self.checkBox.isChecked(), self.checkbox2.isChecked(), self.checkBox1.isChecked()]):
self.checkbox5.setEnabled(True)
else:
self.checkbox5.setEnabled(False)
if self.checkBox.isChecked() and self.checkbox2.isChecked():
self.checkbox2.setChecked(False)
if self.checkBox.isChecked():
self.checkbox4.setEnabled(True)
else:
self.checkbox4.setEnabled(False)
def num_col2(self):
if any([self.checkBox.isChecked(), self.checkbox2.isChecked(), self.checkBox1.isChecked()]):
self.checkbox5.setEnabled(True)
else:
self.checkbox5.setEnabled(False)
if all([self.checkbox2.isChecked(), self.checkBox.isChecked()]):
self.checkBox.setChecked(False)
self.checkbox4.setEnabled(False)
if self.checkbox2.isChecked():
self.btn_maincolor.setEnabled(False)
else:
self.btn_maincolor.setEnabled(True)
def fill_change(self):
if any([self.checkBox.isChecked(), self.checkbox2.isChecked(), self.checkBox1.isChecked()]):
self.checkbox5.setEnabled(True)
else:
self.checkbox5.setEnabled(False)
if self.checkBox1.isChecked():
self.btn_bgcolor.setEnabled(False)
else:
self.btn_bgcolor.setEnabled(True)
def color_pick_main(self):
global main_color
color = QtWidgets.QColorDialog.getColor()
main_color = color.getRgb()[:3]
self.clr_main.setStyleSheet('background-color: {};'.format(color.name()))
def color_pick_bg(self):
global bg_color
color = QtWidgets.QColorDialog.getColor()
bg_color = color.getRgb()[:3]
self.clr_bg.setStyleSheet('background-color: {};'.format(color.name()))
def display_img_size(self):
global final_height, final_width
self.label_3.setText("Final Image size : {width} x {height}".format(width=final_width, height=final_height))
self.label_3.adjustSize()
def show_about(self):
global icon
dialog = QtWidgets.QMessageBox()
dialog.setWindowTitle('About')
dialog.setWindowIcon(icon)
dialog.setText('This programm is created by mohammadamin Alidoost\n\nContact me: [email protected]')
dialog.setIcon(QtWidgets.QMessageBox.Information)
dialog.setStandardButtons(QtWidgets.QMessageBox.Ok)
dialog.exec()
def btn_browse_clicked(self):
global img, width, height, final_height, final_width
filename = QtWidgets.QFileDialog.getOpenFileName(filter='Imgaes (*.png *.jpg *.jpeg)')[0]
if not filename:
return
self.edt_browse.setText(filename)
img = imread(filename, 0)
height, width = img.shape[:2]
final_width, final_height = self.standard_Image_Size()
self.display_img_size()
def btn_save_clicked(self):
global final_img
try:
if not final_img:
return
except ValueError:
path = QtWidgets.QFileDialog.getSaveFileName(filter='Images(*.Jpg *.Jpeg *.png)')[0]
if not path:
return
imwrite(path, final_img)
def btn_progress_clicked(self):
global final_img, final_height, final_width, width, height, img_1, img_0
self.lb_Done.setText('')
self.progressBar.setValue(0)
sens = int(self.sens.value() * 255)
img_1 = imread('res/' + self.comboBox.currentText() + '/' + list(filter(lambda x: x.lower().startswith('1'), os.listdir('res/' + self.comboBox.currentText())))[0], 0)
img_0 = imread('res/' + self.comboBox.currentText() + '/' + list(filter(lambda x: x.lower().startswith('0'), os.listdir('res/' + self.comboBox.currentText())))[0], 0)
if img_0.shape[:2] != (13, 8):
im_0_name = 'res/' + self.comboBox.currentText() + '/' + list(filter(lambda x: x.lower().startswith('0'), os.listdir('res/' + self.comboBox.currentText())))[0]
Image.open(im_0_name).resize((8, 13)).save(im_0_name)
img_0 = imread(im_0_name, 0)
if img_1.shape[:2] != (13, 8):
im_1_name = 'res/' + self.comboBox.currentText() + '/' + list(filter(lambda x: x.lower().startswith('1'), os.listdir('res/' + self.comboBox.currentText())))[0]
Image.open(im_1_name).resize(8, 13).save(im_1_name)
img_1 = imread(im_1_name, 0)
if self.edt_browse.text() == 'Choose Your Image...' or not os.path.isfile(self.edt_browse.text()):
return
if self.checkBox1.isChecked() or self.checkbox2.isChecked():
if self.checkbox3.isChecked():
img_tmp = resize(imread(self.edt_browse.text()), (final_width, final_height))
else:
img_tmp = resize(img, (final_width, final_height))
final_img = np.zeros((final_height, final_width, 3), np.uint8)
img_tm = resize(img, (int(width / self.spinBox.value()), int(height / self.spinBox_2.value())))
if self.checkBox_r.isChecked():
zero = 1
one = 0
else:
zero = 0
one = 1
tmp = []
if self.checkBox.isChecked():
for i in range(img_tm.shape[0]):
tmp.append([])
for j in range(img_tm.shape[1]):
if not self.checkbox5.isChecked():
if img_tm[i][j] < sens:
tmp[i].append((one, img_tm[i][j]))
else:
tmp[i].append((zero, img_tm[i][j]))
else:
tmp[i].append((randint(0, 1), img_tm[i][j]))
else:
for i in range(img_tm.shape[0]):
tmp.append([])
for j in range(img_tm.shape[1]):
if not self.checkbox5.isChecked():
if img_tm[i][j] < sens:
tmp[i].append(one)
else:
tmp[i].append(zero)
else:
tmp[i].append(randint(0, 1))
for i in range(final_height):
for j in range(final_width):
tm = tmp[i // 13][j // 8]
# Check Gradient
if self.checkBox.isChecked():
val = tm[1]
if max(main_color) == 0:
light_color = (255, 255, 255)
else:
light_color = tuple(map(lambda x: x * (255 // max(main_color)), main_color))
if tm[0] == 0:
if self.checkBox1.isChecked():
if img_0[i % 13][j % 8] > 127:
if self.checkbox3.isChecked():
final_img[i][j][0] = img_tmp[i][j][0]
final_img[i][j][1] = img_tmp[i][j][1]
final_img[i][j][2] = img_tmp[i][j][2]
else:
final_img[i][j][0] = img_tmp[i][j]
final_img[i][j][1] = img_tmp[i][j]
final_img[i][j][2] = img_tmp[i][j]
else:
if self.checkbox4.isChecked():
final_img[i][j][0] = (((255-val) / 255) * light_color[2])
final_img[i][j][1] = (((255-val) / 255) * light_color[1])
final_img[i][j][2] = (((255-val) / 255) * light_color[0])
else:
final_img[i][j][0] = ((val / 255) * light_color[2])
final_img[i][j][1] = ((val / 255) * light_color[1])
final_img[i][j][2] = ((val / 255) * light_color[0])
else:
if img_0[i % 13][j % 8] > 127:
final_img[i][j][0] = bg_color[2]
final_img[i][j][1] = bg_color[1]
final_img[i][j][2] = bg_color[0]
else:
if self.checkbox4.isChecked():
final_img[i][j][0] = (((255-val) / 255) * light_color[2])
final_img[i][j][1] = (((255-val) / 255) * light_color[1])
final_img[i][j][2] = (((255-val) / 255) * light_color[0])
else:
final_img[i][j][0] = ((val / 255) * light_color[2])
final_img[i][j][1] = ((val / 255) * light_color[1])
final_img[i][j][2] = ((val / 255) * light_color[0])
else:
if self.checkBox1.isChecked():
if img_1[i % 13][j % 8] > 127:
if self.checkbox3.isChecked():
final_img[i][j][0] = img_tmp[i][j][0]
final_img[i][j][1] = img_tmp[i][j][1]
final_img[i][j][2] = img_tmp[i][j][2]
else:
final_img[i][j][0] = img_tmp[i][j]
final_img[i][j][1] = img_tmp[i][j]
final_img[i][j][2] = img_tmp[i][j]
else:
if self.checkbox4.isChecked():
final_img[i][j][0] = (((255-val) / 255) * light_color[2])
final_img[i][j][1] = (((255-val) / 255) * light_color[1])
final_img[i][j][2] = (((255-val) / 255) * light_color[0])
else:
final_img[i][j][0] = ((val / 255) * light_color[2])
final_img[i][j][1] = ((val / 255) * light_color[1])
final_img[i][j][2] = ((val / 255) * light_color[0])
else:
if img_1[i % 13][j % 8] > 127:
final_img[i][j][0] = bg_color[2]
final_img[i][j][1] = bg_color[1]
final_img[i][j][2] = bg_color[0]
else:
if self.checkbox4.isChecked():
final_img[i][j][0] = (((255-val) / 255) * light_color[2])
final_img[i][j][1] = (((255-val) / 255) * light_color[1])
final_img[i][j][2] = (((255-val) / 255) * light_color[0])
else:
final_img[i][j][0] = ((val / 255) * light_color[2])
final_img[i][j][1] = ((val / 255) * light_color[1])
final_img[i][j][2] = ((val / 255) * light_color[0])
# End of Gradient
else:
if self.checkBox1.isChecked():
if tm == 0:
if img_0[i % 13][j % 8] > 127:
if self.checkbox3.isChecked():
final_img[i][j][0] = img_tmp[i][j][0]
final_img[i][j][1] = img_tmp[i][j][1]
final_img[i][j][2] = img_tmp[i][j][2]
else:
final_img[i][j][0] = img_tmp[i][j]
final_img[i][j][1] = img_tmp[i][j]
final_img[i][j][2] = img_tmp[i][j]
else:
if self.checkbox2.isChecked():
if self.checkbox3.isChecked():
final_img[i][j][0] = img_tmp[i][j][0]
final_img[i][j][1] = img_tmp[i][j][1]
final_img[i][j][2] = img_tmp[i][j][2]
else:
final_img[i][j][0] = img_tmp[i][j]
final_img[i][j][1] = img_tmp[i][j]
final_img[i][j][2] = img_tmp[i][j]
else:
final_img[i][j][0] = main_color[2]
final_img[i][j][1] = main_color[1]
final_img[i][j][2] = main_color[0]
else:
if img_1[i % 13][j % 8] > 127:
if self.checkbox3.isChecked():
final_img[i][j][0] = img_tmp[i][j][0]
final_img[i][j][1] = img_tmp[i][j][1]
final_img[i][j][2] = img_tmp[i][j][2]
else:
final_img[i][j][0] = img_tmp[i][j]
final_img[i][j][1] = img_tmp[i][j]
final_img[i][j][2] = img_tmp[i][j]
else:
if self.checkbox2.isChecked():
if self.checkbox3.isChecked():
final_img[i][j][0] = img_tmp[i][j][0]
final_img[i][j][1] = img_tmp[i][j][1]
final_img[i][j][2] = img_tmp[i][j][2]
else:
final_img[i][j][0] = img_tmp[i][j]
final_img[i][j][1] = img_tmp[i][j]
final_img[i][j][2] = img_tmp[i][j]
else:
final_img[i][j][0] = main_color[2]
final_img[i][j][1] = main_color[1]
final_img[i][j][2] = main_color[0]
else:
if tm == 0:
if img_0[i % 13][j % 8] > 127:
final_img[i][j][0] = bg_color[2]
final_img[i][j][1] = bg_color[1]
final_img[i][j][2] = bg_color[0]
else:
if self.checkbox2.isChecked():
if self.checkbox3.isChecked():
final_img[i][j][0] = img_tmp[i][j][0]
final_img[i][j][1] = img_tmp[i][j][1]
final_img[i][j][2] = img_tmp[i][j][2]
else:
final_img[i][j][0] = img_tmp[i][j]
final_img[i][j][1] = img_tmp[i][j]
final_img[i][j][2] = img_tmp[i][j]
else:
final_img[i][j][0] = main_color[2]
final_img[i][j][1] = main_color[1]
final_img[i][j][2] = main_color[0]
else:
if img_1[i % 13][j % 8] > 127:
final_img[i][j][0] = bg_color[2]
final_img[i][j][1] = bg_color[1]
final_img[i][j][2] = bg_color[0]
else:
if self.checkbox2.isChecked():
if self.checkbox3.isChecked():
final_img[i][j][0] = img_tmp[i][j][0]
final_img[i][j][1] = img_tmp[i][j][1]
final_img[i][j][2] = img_tmp[i][j][2]
else:
final_img[i][j][0] = img_tmp[i][j]
final_img[i][j][1] = img_tmp[i][j]
final_img[i][j][2] = img_tmp[i][j]
else:
final_img[i][j][0] = main_color[2]
final_img[i][j][1] = main_color[1]
final_img[i][j][2] = main_color[0]
self.lb_Done.setText('Done !')
self.lb_Done.adjustSize()
self.progressBar.setValue(100)
if display.onScreen:
self.ui.update(final_img)
def standard_Image_Size(self):
global width, height
spin = self.spinBox.value()
spin2 = self.spinBox_2.value()
width_res = int(width / spin) * 8
height_res = int(height / spin2) * 13
return width_res, height_res
if __name__ == "__main__":
def btn_clicked(_):
sys.exit(0)
app = QtWidgets.QApplication(sys.argv)
# res detect
pixmap = QtGui.QPixmap()
pixmap.loadFromData(QtCore.QByteArray.fromBase64(
b'iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAMAAADDpiTIAAABsFBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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fMzOaZS0MHlM2tf+9uEgAzO8tcGjsA+3hUbF32nMXM2szV0tACZta/829FJQxTmQUzm2f+f8wTjSE/AZsmAAAAAElFTkSuQmCC'))
icon = QtGui.QIcon(pixmap)
try:
for i in os.listdir('res'):
if os.path.isdir('res/' + i):
ress.append(i)
except FileNotFoundError:
dialog = QtWidgets.QMessageBox()
dialog.setIcon(QtWidgets.QMessageBox.Critical)
dialog.setText('Failed to access /res directory')
dialog.setWindowTitle('Error')
dialog.setWindowIcon(icon)
dialog.setStandardButtons(QtWidgets.QMessageBox.Ok)
dialog.buttonClicked.connect(btn_clicked)
dialog.show()
QtCore.QEventLoop().exec_()
# end
ui = Ui_MainWindow()
ui.setupUi()
sys.exit(app.exec_())