summaryrefslogtreecommitdiff
path: root/audio/decibel-audio-player/covers-pil.patch
blob: baf22357ffed318a5eb15dc4a27b115244a22b40 (plain)
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
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