[svn r7417] Make the non-map versions PNGs since they're smaller that way and we lose the

JPEG artifacts.
This commit is contained in:
olly
2006-06-22 19:38:02 +02:00
parent eb0545f2ab
commit f12e29ce67
14 changed files with 20 additions and 17 deletions

View File

@@ -160,7 +160,10 @@ def get_img_name(maparea):
filename = "prospecting_guide"
if maparea != "all":
filename += "_" + maparea + "area"
filename += ".jpg"
if showbg:
filename += ".jpg"
else:
filename += ".png"
return filename
# Parameters for big map and zoomed subarea maps:
@@ -190,8 +193,6 @@ B = 3
ZOOM = 4
DESC = 5
allwhite = False
import Image, ImageDraw, ImageFont, string, os, sys
for FONT in [
"/usr/share/fonts/truetype/freefont/FreeSans.ttf",
@@ -202,8 +203,9 @@ for FONT in [
SIZE = 8
myFont = ImageFont.truetype(FONT, SIZE)
showbg = not(len(sys.argv) > 1 and sys.argv[1] == '--white')
mainImage = Image.open("pguidemap.jpg")
if len(sys.argv) > 1 and sys.argv[1] == '--white':
if not showbg:
mainImage = Image.new("RGB", mainImage.size, '#ffffff')
imgs = {}
@@ -399,7 +401,8 @@ for maparea in mapcodes:
filename = get_img_name(maparea)
if maparea != "all":
htmlfile.write("<h3 id=\"idsubmap%s\">%s area detail</h3>\n" % (maparea, maps[maparea][DESC]))
htmlfile.write("<button onclick=\"if (bg%s) img%s.src = '%s'; else img%s.src = '../noinfo/%s'; bg%s = !bg%s;\">Toggle Background</button>\n" % (maparea, maparea, filename, maparea, filename, maparea, maparea))
basename = filename[0:-3]
htmlfile.write("<button onclick=\"if (bg%s) img%s.src = '%spng'; else img%s.src = '../noinfo/%sjpg'; bg%s = !bg%s;\">Toggle Background</button>\n" % (maparea, maparea, basename, maparea, basename, maparea, maparea))
htmlfile.write("<small>Note: this requires a login to work!</small>\n")
htmlfile.write("<p><img src=\"%s\" usemap=\"#map%s\" ismap=\"ismap\" name=\"img%s\"" % (filename, maparea, maparea))
htmlfile.write(" width=\"%d\" height=\"%d\" /></p>\n" % imgs[maparea].size)
@@ -508,6 +511,6 @@ htmlfile.close()
for maparea in imgs.keys():
del draws[maparea]
filename = get_img_name(maparea)
imgs[maparea].save("../" + filename, "JPEG")
imgs[maparea].save("../" + filename)
# vim:syntax=python:set ts=4:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB