Browse Source

add canonical file name option

master
Markus Becker 1 year ago
parent
commit
e27cede4b2
2 changed files with 6 additions and 1 deletions
  1. +3
    -0
      falchicon.py
  2. +3
    -1
      graphics.py

+ 3
- 0
falchicon.py View File

@ -31,6 +31,7 @@ if __name__ == '__main__':
parser.add_argument('outfile', metavar='FILE', nargs='?', help='image file to write to')
parser.add_argument('--show', '-s', dest='show', action='store_true', help='try to show image instead of saving it')
parser.add_argument('--tomorrow', dest='tomorrow', action='store_true', help='toggle to generate icon for tomorrow (identical to -a 1)')
parser.add_argument('--canonical', dest='canon', action='store_true', help='use canonical FILE when none provided')
parser.add_argument('--advance', '-a', type=int, metavar='<days>', help='days to advance (overrides --tomorrow)')
parser.add_argument('--salt', dest='salt', type=str, default='falchicon', help='salt to use for hash')
parser.add_argument('--version', action='version', version=VERSION)
@ -51,6 +52,8 @@ if __name__ == '__main__':
img.show()
elif args.outfile:
img.save(args.outfile)
elif args.canon:
img.save(f"falchicon_{day}.png")
else:
print('No destination file provided, and no --show present. Pass --help for possible arguments.')

+ 3
- 1
graphics.py View File

@ -1,5 +1,6 @@
from PIL import Image, ImageDraw, ImageOps
import os
SIZE = 512
RASTER = 8
@ -10,7 +11,8 @@ half = int(SIZE/2)
quarter = int(SIZE/4)
eight = int(SIZE/8)
bib_img = Image.open('resources/bib.png')
bib_file = os.path.join(os.path.split(__file__)[0], "resources/bib.png")
bib_img = Image.open(bib_file)
bib_img_8 = bib_img.resize((full, full))
bib_img_4 = bib_img.resize((half, half))
bib_img_2 = bib_img.resize((quarter, quarter))

Loading…
Cancel
Save