Skip to content

Commit c345282

Browse files
MrServoHains
authored andcommitted
[LCD4linux] V5.0-r31 fix for Py3-PIL rotate function
- Py3-PIL library needs an additional parameter 'expand=True' for proper rotation of picture THX to User KenTucky @ OpenA.TV details see: https://www.opena.tv/viewtopic.php?p=589947#p589940 HINT: **LCD4linux** is still working under Python2 and Python3
1 parent 8998e98 commit c345282

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

lcd4linux/src/plugin.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
if find_library("usb-0.1") is not None or find_library("usb-1.0") is not None:
173173
print("[LCD4linux] libusb found :-)", getEnigmaVersionString())
174174
USBok = True
175-
Version = "V5.0-r30"
175+
Version = "V5.0-r31"
176176
L4LElist = L4Lelement()
177177
L4LdoThread = True
178178
LCD4enigma2config = resolveFilename(SCOPE_CONFIG) # /etc/enigma2/
@@ -3247,7 +3247,7 @@ def writeLCD1(s, im, quality, SAVE=True):
32473247
doDPF(1, im, s)
32483248
if "1" in LCD4linux.SavePicture.value and SAVE == True:
32493249
if str(LCD4linux.LCDRotate1.value) != "0":
3250-
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value))
3250+
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value), expand=True)
32513251
try:
32523252
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
32533253
if isfile(bild):
@@ -3280,7 +3280,7 @@ def writeLCD1(s, im, quality, SAVE=True):
32803280
try:
32813281
if "1" in LCD4linux.SavePicture.value and SAVE == True:
32823282
if str(LCD4linux.LCDRotate1.value) != "0":
3283-
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value))
3283+
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value), expand=True)
32843284
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
32853285
if isfile(bild):
32863286
rename(bild, "%s.png" % PIC)
@@ -3331,7 +3331,7 @@ def writeLCD1(s, im, quality, SAVE=True):
33313331
try:
33323332
datei = "%s.jpg" % PICtmp
33333333
if str(LCD4linux.LCDRotate1.value) != "0":
3334-
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value))
3334+
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value), expand=True)
33353335
s.im[im].save(datei, "JPEG")
33363336
elif pic is not None:
33373337
open(datei, "wb").write(pic)
@@ -3367,7 +3367,7 @@ def writeLCD2(s, im, quality, SAVE=True):
33673367
doDPF(2, im, s)
33683368
if "2" in LCD4linux.SavePicture.value and SAVE == True:
33693369
if str(LCD4linux.LCDRotate2.value) != "0":
3370-
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value))
3370+
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value), expand=True)
33713371
try:
33723372
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
33733373
if isfile(bild):
@@ -3389,7 +3389,7 @@ def writeLCD2(s, im, quality, SAVE=True):
33893389
s.im[im].save("/tmp/usbtft-bmp", "BMP")
33903390
if "2" in LCD4linux.SavePicture.value and SAVE == True:
33913391
if str(LCD4linux.LCDRotate2.value) != "0":
3392-
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value))
3392+
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value), expand=True)
33933393
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
33943394
if isfile(bild):
33953395
rename(bild, "%s.png" % PIC2)
@@ -3400,7 +3400,7 @@ def writeLCD2(s, im, quality, SAVE=True):
34003400
try:
34013401
if "2" in LCD4linux.SavePicture.value and SAVE == True:
34023402
if str(LCD4linux.LCDRotate2.value) != "0":
3403-
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value))
3403+
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value), expand=True)
34043404
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
34053405
if isfile(bild):
34063406
rename(bild, "%s.png" % PIC2)
@@ -3451,7 +3451,7 @@ def writeLCD2(s, im, quality, SAVE=True):
34513451
try:
34523452
datei = "%s.jpg" % PIC2tmp
34533453
if str(LCD4linux.LCDRotate2.value) != "0":
3454-
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value))
3454+
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value), expand=True)
34553455
s.im[im].save(datei, "JPEG")
34563456
elif pic is not None:
34573457
open(datei, "wb").write(pic)
@@ -3487,7 +3487,7 @@ def writeLCD3(s, im, quality, SAVE=True):
34873487
doDPF(3, im, s)
34883488
if "3" in LCD4linux.SavePicture.value and SAVE == True:
34893489
if str(LCD4linux.LCDRotate3.value) != "0":
3490-
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value))
3490+
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value), expand=True)
34913491
try:
34923492
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
34933493
if isfile(bild):
@@ -3509,7 +3509,7 @@ def writeLCD3(s, im, quality, SAVE=True):
35093509
s.im[im].save("/tmp/usbtft-bmp", "BMP")
35103510
if "3" in LCD4linux.SavePicture.value and SAVE == True:
35113511
if str(LCD4linux.LCDRotate3.value) != "0":
3512-
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value))
3512+
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value), expand=True)
35133513
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
35143514
if isfile(bild):
35153515
rename(bild, "%s.png" % PIC3)
@@ -3520,7 +3520,7 @@ def writeLCD3(s, im, quality, SAVE=True):
35203520
try:
35213521
if "3" in LCD4linux.SavePicture.value and SAVE == True:
35223522
if str(LCD4linux.LCDRotate3.value) != "0":
3523-
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value))
3523+
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value), expand=True)
35243524
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
35253525
if isfile(bild):
35263526
rename(bild, "%s.png" % PIC3)
@@ -3571,7 +3571,7 @@ def writeLCD3(s, im, quality, SAVE=True):
35713571
try:
35723572
datei = "%s.jpg" % PIC3tmp
35733573
if str(LCD4linux.LCDRotate3.value) != "0":
3574-
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value))
3574+
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value), expand=True)
35753575
s.im[im].save(datei, "JPEG")
35763576
elif pic is not None:
35773577
open(datei, "wb").write(pic)
@@ -11722,7 +11722,7 @@ def putClock(workaround, draw, im):
1172211722
else:
1172311723
pil_image = pil_image.resize((x1, y1), Image.LANCZOS if PY3 else Image.ANTIALIAS)
1172411724
S = int(strftime("%H")) % 12
11725-
pil_image = pil_image.rotate(360 - int(30 * S + int(int(strftime("%M")) / 2))).convert("RGBA") # 360/12
11725+
pil_image = pil_image.rotate(360 - int(30 * S + int(int(strftime("%M")) / 2)), expand=True).convert("RGBA") # 360/12
1172611726
self.im[im].paste(pil_image, (POSX + int((x - x1) / 2), ConfigPos + int((y - y1) / 2)), pil_image)
1172711727
# Minute
1172811728
pil_image = Image.open(Clock + str(ConfigAnalog) + "/Minute.png")
@@ -11733,7 +11733,7 @@ def putClock(workaround, draw, im):
1173311733
pil_image = pil_image.resize((x1, y1))
1173411734
else:
1173511735
pil_image = pil_image.resize((x1, y1), Image.LANCZOS if PY3 else Image.ANTIALIAS)
11736-
pil_image = pil_image.rotate(360 - int(6 * int(strftime("%M")))).convert("RGBA") # 360/60
11736+
pil_image = pil_image.rotate(360 - int(6 * int(strftime("%M"))), expand=True).convert("RGBA") # 360/60
1173711737
self.im[im].paste(pil_image, (POSX + int((x - x1) / 2), ConfigPos + int((y - y1) / 2)), pil_image)
1173811738
# Seconds: Due to the bad refresh rates, the second hand was deliberately not programmed!
1173911739
# Date underneath clockface
@@ -15431,21 +15431,21 @@ def Lput4(LCD, SCR, FUNC, PARA):
1543115431
self.draw[1].rectangle((0, 0, MAX_W, MAX_H), fill="black")
1543215432
QuickList = [[], [], []]
1543315433
if str(LCD4linux.LCDRotate1.value) != "0":
15434-
self.im[1] = self.im[1].rotate(int(LCD4linux.LCDRotate1.value))
15434+
self.im[1] = self.im[1].rotate(int(LCD4linux.LCDRotate1.value), expand=True)
1543515435
Brief1.put([writeLCD1, self, 1, LCD4linux.BilderJPEG.value])
1543615436
if LCD4linux.LCDType2.value != "00" and self.Refresh >= LCD4linux.LCDRefresh2.value and not (getSA(2) in LCD4linux.TV.value and "2" in LCD4linux.TVLCD.value and not Standby.inStandby):
1543715437
if Dunkel and "2" in Dunkel:
1543815438
MAX_W, MAX_H = self.im[2].size
1543915439
self.draw[2].rectangle((0, 0, MAX_W, MAX_H), fill="black")
1544015440
if str(LCD4linux.LCDRotate2.value) != "0":
15441-
self.im[2] = self.im[2].rotate(int(LCD4linux.LCDRotate2.value))
15441+
self.im[2] = self.im[2].rotate(int(LCD4linux.LCDRotate2.value), expand=True)
1544215442
Brief2.put([writeLCD2, self, 2, LCD4linux.BilderJPEG.value])
1544315443
if LCD4linux.LCDType3.value != "00" and self.Refresh >= LCD4linux.LCDRefresh3.value and not (getSA(3) in LCD4linux.TV.value and "3" in LCD4linux.TVLCD.value and not Standby.inStandby):
1544415444
if Dunkel and "3" in Dunkel:
1544515445
MAX_W, MAX_H = self.im[3].size
1544615446
self.draw[3].rectangle((0, 0, MAX_W, MAX_H), fill="black")
1544715447
if str(LCD4linux.LCDRotate3.value) != "0":
15448-
self.im[3] = self.im[3].rotate(int(LCD4linux.LCDRotate3.value))
15448+
self.im[3] = self.im[3].rotate(int(LCD4linux.LCDRotate3.value), expand=True)
1544915449
Brief3.put([writeLCD3, self, 3, LCD4linux.BilderJPEG.value])
1545015450
Brief1.join()
1545115451
Brief2.join()

0 commit comments

Comments
 (0)