00001
00002 import sys
00003 import os
00004 import Image,ImageDraw,ImageFont,ImageChops
00005
00006 s = float(sys.argv[1])
00007 for n in sys.argv[2:]:
00008 w,h = n.split("x")
00009 w = int(w)
00010 h = int(h)
00011 img = Image.new("L",(w+1,h+1),1)
00012 draw = ImageDraw.Draw(img)
00013 for x in range(w+1):
00014 for y in range(h+1):
00015 c=(x+y)%2
00016
00017 draw.point( (x,y), c*255 )
00018 img.save("%s.png"%n,"PNG")
00019
00020 with open('markers.tex', 'w') as f:
00021 f.write("""
00022 \\documentclass[a4paper,10pt]{article}\n
00023 \\usepackage{graphicx}\n
00024 \\usepackage{a4wide}\n
00025 \\usepackage{color}\n
00026 \\begin{document}\n
00027 \\tiny
00028 \\definecolor{gray}{rgb}{0.5,0.5,0.5}
00029 \\color{gray}
00030 """)
00031
00032 for n in sys.argv[2:]:
00033 w,h = n.split("x")
00034 w = int(w)
00035 h = int(h)
00036 f.write("\\indent\\hspace{-2cm}\\includegraphics[width=%dcm]{%s}\\newline$ $\\newline %s\\vspace{2cm}\n\\newline \\newline "%((w+1)*s,n,n.replace("_","-")))
00037
00038 f.write("\\end{document}\n")
00039
00040 os.system("pdflatex markers")
00041 os.system("evince markers.pdf")
00042
00043