mirror of
https://github.com/Ponce/slackbuilds
synced 2024-12-01 01:00:03 +01:00
bde21007fb
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
100 lines
No EOL
4.2 KiB
Diff
100 lines
No EOL
4.2 KiB
Diff
diff -crB src/decibel-audio-player-1.08/src/modules/Covers.py src_patched/decibel-audio-player-1.08/src/modules/Covers.py
|
|
*** src/decibel-audio-player-1.08/src/modules/Covers.py 2011-09-19 12:09:25.000000000 +0200
|
|
--- src_patched/decibel-audio-player-1.08/src/modules/Covers.py 2014-10-19 05:43:49.575245931 +0200
|
|
***************
|
|
*** 124,140 ****
|
|
|
|
def generateFullSizeCover(self, inFile, outFile, format):
|
|
""" Resize inFile if needed, and write it to outFile (outFile and inFile may be equal) """
|
|
! import Image
|
|
|
|
try:
|
|
# Open the image
|
|
! cover = Image.open(inFile)
|
|
|
|
# Fit the image into FULLSIZE_WIDTH x FULLSIZE_HEIGHT
|
|
(newWidth, newHeight) = self.__resizeWithRatio(cover.size[PIL_WIDTH], cover.size[PIL_HEIGHT], FULLSIZE_WIDTH, FULLSIZE_HEIGHT)
|
|
|
|
# Resize it
|
|
! cover = cover.resize((newWidth, newHeight), Image.ANTIALIAS)
|
|
|
|
# We're done
|
|
cover.save(outFile, format)
|
|
--- 124,140 ----
|
|
|
|
def generateFullSizeCover(self, inFile, outFile, format):
|
|
""" Resize inFile if needed, and write it to outFile (outFile and inFile may be equal) """
|
|
! import PIL.Image
|
|
|
|
try:
|
|
# Open the image
|
|
! cover = PIL.Image.open(inFile)
|
|
|
|
# Fit the image into FULLSIZE_WIDTH x FULLSIZE_HEIGHT
|
|
(newWidth, newHeight) = self.__resizeWithRatio(cover.size[PIL_WIDTH], cover.size[PIL_HEIGHT], FULLSIZE_WIDTH, FULLSIZE_HEIGHT)
|
|
|
|
# Resize it
|
|
! cover = cover.resize((newWidth, newHeight), PIL.Image.ANTIALIAS)
|
|
|
|
# We're done
|
|
cover.save(outFile, format)
|
|
***************
|
|
*** 144,154 ****
|
|
|
|
def generateThumbnail(self, inFile, outFile, format):
|
|
""" Generate a thumbnail from inFile (e.g., resize it) and write it to outFile (outFile and inFile may be equal) """
|
|
! import Image
|
|
|
|
try:
|
|
# Open the image
|
|
! cover = Image.open(inFile).convert('RGBA')
|
|
|
|
# Fit the image into THUMBNAIL_WIDTH x THUMBNAIL_HEIGHT
|
|
(newWidth, newHeight) = self.__resizeWithRatio(cover.size[PIL_WIDTH], cover.size[PIL_HEIGHT], THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT)
|
|
--- 144,154 ----
|
|
|
|
def generateThumbnail(self, inFile, outFile, format):
|
|
""" Generate a thumbnail from inFile (e.g., resize it) and write it to outFile (outFile and inFile may be equal) """
|
|
! import PIL.Image
|
|
|
|
try:
|
|
# Open the image
|
|
! cover = PIL.Image.open(inFile).convert('RGBA')
|
|
|
|
# Fit the image into THUMBNAIL_WIDTH x THUMBNAIL_HEIGHT
|
|
(newWidth, newHeight) = self.__resizeWithRatio(cover.size[PIL_WIDTH], cover.size[PIL_HEIGHT], THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT)
|
|
***************
|
|
*** 161,176 ****
|
|
else: offsetY = 0
|
|
|
|
# Resize the image
|
|
! cover = cover.resize((newWidth, newHeight), Image.ANTIALIAS)
|
|
|
|
# Paste the resized cover into our model
|
|
! model = Image.open(THUMBNAIL_MODEL).convert('RGBA')
|
|
model.paste(cover, (THUMBNAIL_OFFSETX + offsetX, THUMBNAIL_OFFSETY + offsetY), cover)
|
|
cover = model
|
|
|
|
# Don't apply the gloss effect if asked to
|
|
if not prefs.getCmdLine()[0].no_glossy_cover:
|
|
! gloss = Image.open(THUMBNAIL_GLOSS).convert('RGBA')
|
|
cover.paste(gloss, (0, 0), gloss)
|
|
|
|
# We're done
|
|
--- 161,176 ----
|
|
else: offsetY = 0
|
|
|
|
# Resize the image
|
|
! cover = cover.resize((newWidth, newHeight), PIL.Image.ANTIALIAS)
|
|
|
|
# Paste the resized cover into our model
|
|
! model = PIL.Image.open(THUMBNAIL_MODEL).convert('RGBA')
|
|
model.paste(cover, (THUMBNAIL_OFFSETX + offsetX, THUMBNAIL_OFFSETY + offsetY), cover)
|
|
cover = model
|
|
|
|
# Don't apply the gloss effect if asked to
|
|
if not prefs.getCmdLine()[0].no_glossy_cover:
|
|
! gloss = PIL.Image.open(THUMBNAIL_GLOSS).convert('RGBA')
|
|
cover.paste(gloss, (0, 0), gloss)
|
|
|
|
# We're done
|