update icons
This commit is contained in:
parent
795c36313a
commit
6a6fefede0
|
@ -13,7 +13,7 @@ from common import SRC_PATH, ASSET_PATH, get_logo_path, get_logo_raw_url
|
|||
|
||||
|
||||
L = 120 # dim of image
|
||||
S = int(L * 0.35) # dim of wormhole logo
|
||||
S = int(L * 0.5) # dim of wormhole logo
|
||||
OFFSET = 0
|
||||
REM = L-S
|
||||
STANDARD_DIM = (L, L)
|
||||
|
@ -84,11 +84,25 @@ def get_base_logo(name):
|
|||
else:
|
||||
response = requests.get(logo_url, headers={'User-Agent': 'Mozilla/5.0'})
|
||||
img = Image.open(BytesIO(response.content))
|
||||
return img.resize(STANDARD_DIM).convert('RGBA')
|
||||
|
||||
SMALLER_DIM = (L - 30, L - 30) # subtract to account for margins of base logo
|
||||
img = img.resize(SMALLER_DIM).convert('RGBA')
|
||||
|
||||
# calculate margins to make it back to STANDARD_DIM
|
||||
margin_horizontal = (STANDARD_DIM[0] - SMALLER_DIM[0]) // 2
|
||||
margin_vertical = (STANDARD_DIM[1] - SMALLER_DIM[1]) // 2
|
||||
|
||||
# add margins
|
||||
img = add_margin(img, margin_vertical, margin_horizontal, margin_vertical, margin_horizontal)
|
||||
|
||||
return img
|
||||
|
||||
|
||||
def get_logo(name, wormhole=True, chain=None, style=None):
|
||||
stack = [get_base_logo(name)]
|
||||
# Get base logo and add margin to it
|
||||
base_logo = get_base_logo(name)
|
||||
|
||||
stack = [base_logo]
|
||||
if wormhole:
|
||||
stack.append(get_wormhole_logo(style=style))
|
||||
if chain is not None:
|
||||
|
@ -100,6 +114,7 @@ def get_logo(name, wormhole=True, chain=None, style=None):
|
|||
return composite
|
||||
|
||||
|
||||
|
||||
def write_logo(name, outpath, wormhole=True, chain=None, style=None):
|
||||
composite = get_logo(name, wormhole=wormhole, chain=chain, style=style)
|
||||
composite.save(outpath)
|
||||
|
@ -144,4 +159,4 @@ if __name__ == "__main__":
|
|||
parser.add_argument('--overwrite', '-o', action='store_true')
|
||||
parser.add_argument('--style', '-s', choices=['barecolor', 'color', 'thickgray', 'thingray', None])
|
||||
args, unknown_args = parser.parse_known_args()
|
||||
write_logos(overwrite=args.overwrite, style=args.style)
|
||||
write_logos(overwrite=args.overwrite, style=args.style)
|
Loading…
Reference in New Issue