mirror of
https://github.com/stronk-dev/Guitar-Sheet-Parser.git
synced 2025-07-05 00:25:08 +02:00
Added variable for aggressiveness when resizing down, since we also consider whitespace atm we can do this more aggressively at the cost of speed
This commit is contained in:
parent
72c4daa126
commit
5c82258228
@ -48,7 +48,8 @@ def initConfig():
|
||||
'metadataColour': '128,128,128',
|
||||
'topMargin': 50,
|
||||
'leftMargin': 50,
|
||||
'rightMargin': 50
|
||||
'rightMargin': 50,
|
||||
'tryToShrinkRatio' : 0.25
|
||||
}
|
||||
# (if CMD arguments: load CMD arguments to override specific settings)
|
||||
with open('config.ini', 'w') as configfile:
|
||||
|
@ -221,6 +221,8 @@ class Song:
|
||||
self.metadataFontsize = int(configObj['metaFontWeight'])
|
||||
self.metadataFontFamily = configObj['metafontfamily']
|
||||
self.fontMetadata = ImageFont.truetype(self.metadataFontFamily, self.metadataFontsize)
|
||||
# percentageof missing whitespace and total page height
|
||||
self.tryToShrinkRatio = float(configObj['tryToShrinkRatio'])
|
||||
|
||||
|
||||
|
||||
@ -366,7 +368,8 @@ class Song:
|
||||
shortInPercentages = amountWeAreShort / self.imageHeight
|
||||
#print("Whitespace {} vs next section height {}".format(whitespace, nextFirstSection.expectedHeight))
|
||||
#print("We are {} short to fit the next image (total image height {} => {}% of total height)".format(amountWeAreShort, self.imageHeight, shortInPercentages*100))
|
||||
if shortInPercentages < 0.15:
|
||||
# Since we also resize based on minimum required whitespaces, we can be a bit more aggressive with this
|
||||
if shortInPercentages < self.tryToShrinkRatio:
|
||||
return True
|
||||
currentPageIt += 1
|
||||
return False
|
||||
|
Loading…
x
Reference in New Issue
Block a user