diff --git a/.gitignore b/.gitignore index a136337..1944fd6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -*.pdf +*.tmp diff --git a/HP 3457A Operating.pdf b/HP 3457A Operating.pdf new file mode 100644 index 0000000..2d18c64 Binary files /dev/null and b/HP 3457A Operating.pdf differ diff --git a/HP 3457A Service.pdf b/HP 3457A Service.pdf new file mode 100644 index 0000000..7a9ba6f Binary files /dev/null and b/HP 3457A Service.pdf differ diff --git a/barcode.py b/barcode.py deleted file mode 100644 index 85f32ce..0000000 --- a/barcode.py +++ /dev/null @@ -1,89 +0,0 @@ -from pylibdmtx import pylibdmtx as dmtx -from PIL import Image, ImageDraw, ImageOps - -white = (255, 255, 255) -black = (0, 0, 0) -nullimg = Image.new('RGB', (9, 15), white) - -chars = [0] * 10 - -# Draw zero -chars[0] = nullimg.copy() -draw = ImageDraw.Draw(chars[0]) -draw.rectangle([(0, 0), (8, 14)], fill=white, outline=black, width=3) - -# Draw one -chars[1] = nullimg.copy() -draw = ImageDraw.Draw(chars[1]) -draw.rectangle([(3, 0), (5, 14)], fill=black, outline=black, width=3) - -# Draw eight -chars[8] = chars[0].copy() -draw = ImageDraw.Draw(chars[8]) -draw.rectangle([(3, 6), (5, 8)], fill=black, outline=black, width=3) - -# Draw two and three -chars[2] = chars[8].copy() -draw = ImageDraw.Draw(chars[2]) -draw.rectangle([(0, 3), (2, 5)], fill=white, outline=white, width=3) -chars[3] = chars[2].copy() # copy to three -draw.rectangle([(6, 9), (8, 11)], fill=white, outline=white, width=3) -# Finish three -draw = ImageDraw.Draw(chars[3]) -draw.rectangle([(0, 9), (2, 11)], fill=white, outline=white, width=3) - -# Draw nine -chars[9] = chars[8].copy() -draw = ImageDraw.Draw(chars[9]) -draw.rectangle([(0, 9), (5, 14)], fill=white, outline=white, width=3) - -# draw four -chars[4] = chars[9].copy() -draw = ImageDraw.Draw(chars[4]) -draw.rectangle([(3, 0), (5, 2)], fill=white, outline=white, width=3) - -# draw five -chars[5] = chars[8].copy() -draw = ImageDraw.Draw(chars[5]) -draw.rectangle([(6, 3), (8, 5)], fill=white, outline=white, width=3) -draw.rectangle([(0, 9), (2, 11)], fill=white, outline=white, width=3) - -# draw six -chars[6] = chars[8].copy() -draw = ImageDraw.Draw(chars[6]) -draw.rectangle([(3, 0), (8, 5)], fill=white, outline=white, width=3) - -# draw seven -chars[7] = chars[8].copy() -draw = ImageDraw.Draw(chars[7]) -draw.rectangle([(0, 3), (5, 14)], fill=white, outline=white, width=3) - -tgt = 'cmdsite/polls/static/polls/' - -def dmxcreate(value): - val = str(int(value)) - # create value image - valimg = Image.new('RGB', - (((9 * len(val)) + (3 * (len(val) - 1))), 15), - white) - for i, x in enumerate(val): - valimg.paste(chars[int(x)], ((9 * i) + (3 * i), 0)) - - # create datamatrix - datamatrix = dmtx.encode(val.encode('utf-8')) - dmximg = Image.frombytes('RGB', - (datamatrix.width, datamatrix.height), - datamatrix.pixels) - - # combine datamatrix with text value - img = Image.new('RGB', - (max([dmximg.width, valimg.width]), - dmximg.height + valimg.height), - white) - img.paste(dmximg, (round(abs((dmximg.width - img.width) / 2)), 0)) - img.paste(valimg, (round(abs((valimg.width - img.width) / 2)), - dmximg.height)) - - # Return grayscale image with transparency - img.putalpha(ImageOps.invert(img).convert('L')) - return img.convert('LA')