Consistent traffic timestamp sizing

Made timestamp appear to be the same size as the weather map.
This commit is contained in:
markjfine 2021-03-30 07:07:38 -04:00 committed by GitHub
parent 5a4886ad65
commit f03bb10125
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -894,9 +894,13 @@ class NRSC5_DUI(object):
# now put a timestamp on it.
imgMap = imgMap.convert("RGBA")
posTS = (imgMap.size[0]-235, imgMap.size[1]-29) # calculate position to put timestamp (bottom right)
imgTS = self.mkTimestamp(t, imgMap.size, posTS) # create timestamp
imgMap = Image.alpha_composite(imgMap, imgTS) # overlay timestamp
imgBig = (981,981) # size of a weather map
#posTS = (imgMap.size[0]-235, imgMap.size[1]-29) # calculate position to put timestamp (bottom right)
posTS = (imgBig[0]-235, imgBig[1]-29) # calculate position to put timestamp (bottom right)
#imgTS = self.mkTimestamp(t, imgMap.size, posTS) # create timestamp
imgTS = self.mkTimestamp(t, imgBig, posTS) # create timestamp for a weather map
imgTS = imgTS.resize((imgMap.size[0], imgMap.size[1]), Image.LANCZOS) # resize it so it's proportional to the size of a traffic map (981 -> 600)
imgMap = Image.alpha_composite(imgMap, imgTS) # overlay timestamp on traffic map
imgMap.save(os.path.join(mapDir, "TrafficMap.png")) # save traffic map