Skip to content

Commit

Permalink
create kindle_scribe_azw3 var
Browse files Browse the repository at this point in the history
  • Loading branch information
axu2 committed Apr 30, 2024
1 parent a1306fb commit ba0d407
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kindlecomicconverter/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def __init__(self, source, options):
self.opt = options
self.source = source
self.size = self.opt.profileData[1]
self.kindle_scribe_azw3 = self.opt.profileData[0] == 'Kindle Scribe' and self.opt.format != 'CBZ'
self.payload = []
self.image = Image.open(os.path.join(source[0], source[1])).convert('RGB')
self.color = self.colorCheck()
Expand Down Expand Up @@ -323,18 +324,18 @@ def resizeImage(self):
self.image = ImageOps.fit(self.image, self.size, method=method)
else: # if image bigger than device resolution or smaller with upscaling
if abs(ratio_image - ratio_device) < AUTO_CROP_THRESHOLD:
if self.opt.profileData[0] == 'Kindle Scribe':
if self.kindle_scribe_azw3:
self.size = (1440, 1920)
self.image = ImageOps.fit(self.image, self.size, method=method)
elif self.opt.format == 'CBZ' or self.opt.kfx:
self.image = ImageOps.pad(self.image, self.size, method=method, color=self.fill)
else:
if self.opt.profileData[0] == 'Kindle Scribe':
if self.kindle_scribe_azw3:
self.size = (1860, 1920)
self.image = ImageOps.contain(self.image, self.size, method=method)

def resize_method(self):
if self.opt.profileData[0] == 'Kindle Scribe':
if self.kindle_scribe_azw3:
if self.image.size[0] <= 1440 and self.image.size[1] <= 1920:
return Image.Resampling.BICUBIC
else:
Expand Down

0 comments on commit ba0d407

Please sign in to comment.