mirror of
https://github.com/stronk-dev/Guitar-Sheet-Parser.git
synced 2025-07-05 08:25:09 +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',
|
'metadataColour': '128,128,128',
|
||||||
'topMargin': 50,
|
'topMargin': 50,
|
||||||
'leftMargin': 50,
|
'leftMargin': 50,
|
||||||
'rightMargin': 50
|
'rightMargin': 50,
|
||||||
|
'tryToShrinkRatio' : 0.25
|
||||||
}
|
}
|
||||||
# (if CMD arguments: load CMD arguments to override specific settings)
|
# (if CMD arguments: load CMD arguments to override specific settings)
|
||||||
with open('config.ini', 'w') as configfile:
|
with open('config.ini', 'w') as configfile:
|
||||||
|
@ -221,6 +221,8 @@ class Song:
|
|||||||
self.metadataFontsize = int(configObj['metaFontWeight'])
|
self.metadataFontsize = int(configObj['metaFontWeight'])
|
||||||
self.metadataFontFamily = configObj['metafontfamily']
|
self.metadataFontFamily = configObj['metafontfamily']
|
||||||
self.fontMetadata = ImageFont.truetype(self.metadataFontFamily, self.metadataFontsize)
|
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
|
shortInPercentages = amountWeAreShort / self.imageHeight
|
||||||
#print("Whitespace {} vs next section height {}".format(whitespace, nextFirstSection.expectedHeight))
|
#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))
|
#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
|
return True
|
||||||
currentPageIt += 1
|
currentPageIt += 1
|
||||||
return False
|
return False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user