diff --git a/notebooks/fancy-qr-code.png b/notebooks/fancy-qr-code.png new file mode 100644 index 0000000..8feb7cf Binary files /dev/null and b/notebooks/fancy-qr-code.png differ diff --git a/notebooks/make-fancy-qr-code.py b/notebooks/make-fancy-qr-code.py new file mode 100644 index 0000000..29b7355 --- /dev/null +++ b/notebooks/make-fancy-qr-code.py @@ -0,0 +1,79 @@ +import qrcode +from qrcode.image.styledpil import StyledPilImage +from qrcode.image.svg import SvgImage +from qrcode.image.styles.moduledrawers import RoundedModuleDrawer +from qrcode.image.styles.colormasks import SolidFillColorMask + +import PIL +from PIL import Image, ImageDraw + +if not hasattr(PIL.Image, 'Resampling'): + PIL.Image.Resampling = PIL.Image +# Now PIL.Image.Resampling.BICUBIC is always recognized. + +import tempfile +import os + +#Custom function for eye styling. These create the eye masks +# Set up parameters +w_cm, h_cm = (10, 10) # Real label size in cm we are just setting it for the new rounded image +res_x, res_y = (300, 300) # Desired resolution +# Inch-to-cm factor +f = 2.54 + +# Determine image size w.r.t. resolution +w = int(w_cm / f * res_x) +h = int(h_cm / f * res_y) + +def add_corners(im, rad, size=(w,h)): + #circle = Image.new('L', (rad * 2, rad * 2), 0) + circle = Image.new('L', size, 0) + draw = ImageDraw.Draw(circle) + draw.ellipse((0, 0, rad * 2 - 1, rad * 2 - 1), fill=255) + alpha = Image.new('L', im.size, 255) + w, h = im.size + alpha.paste(circle.crop((0, 0, rad, rad)), (0, 0)) + alpha.paste(circle.crop((0, rad, rad, rad * 2)), (0, h - rad)) + alpha.paste(circle.crop((rad, 0, rad * 2, rad)), (w - rad, 0)) + alpha.paste(circle.crop((rad, rad, rad * 2, rad * 2)), (w - rad, h - rad)) + im.putalpha(alpha) + return im + +def create_rounded_image(image_path, output_path): + im = Image.open(image_path) + radius = 100 + im = add_corners(im, radius) + im.save(output_path, transparent=True) + +def create_qr(center_logo_path, output_path, data='http://meetingmunch.com/docs'): + + # create a temp path + temp_dir = tempfile.TemporaryDirectory() + print(temp_dir.name) + image_path = os.path.join(temp_dir.name, "rounded.png") + + create_rounded_image(center_logo_path, image_path) + + qr = qrcode.QRCode( + version=None, + error_correction=qrcode.constants.ERROR_CORRECT_H, + box_size=100, + border=4, + ) + + qr.add_data(data) + + qr_img = qr.make_image(image_factory=StyledPilImage, + module_drawer=RoundedModuleDrawer(), + embeded_image_path=image_path,) + # just in case our sticker has different backgound color than white + #color_mask=SolidFillColorMask(front_color=(0,0,0,255), back_color=(255,255,255,0))) + qr_img.save(output_path) + + # use temp_dir, and when done: + temp_dir.cleanup() + +# call the function given the first path being logo +# and the second path being the ouput file path +# I also have the function which creates an SVG of the QR code instead of image +create_qr('../website/static/img/SVG/justlogo.png', "fancy-qr-code.png") \ No newline at end of file diff --git a/notebooks/make-qr-code.py b/notebooks/make-qr-code.py new file mode 100644 index 0000000..fd652d6 --- /dev/null +++ b/notebooks/make-qr-code.py @@ -0,0 +1,24 @@ +import qrcode +import qrcode.image.svg + +# define a method to choose which factory metho to use +# possible values 'basic' 'fragment' 'path' +method = "basic" + +data = "https://meetingmunch.com/docs" + +if method == 'basic': + # Simple factory, just a set of rects. + factory = qrcode.image.svg.SvgImage +elif method == 'fragment': + # Fragment factory (also just a set of rects) + factory = qrcode.image.svg.SvgFragmentImage +elif method == 'path': + # Combined path factory, fixes white space that may occur when zooming + factory = qrcode.image.svg.SvgPathImage + +# Set data to qrcode +img = qrcode.make(data, image_factory = factory) + +# Save svg file somewhere +img.save("qrcode.svg") \ No newline at end of file diff --git a/notebooks/qrcode.svg b/notebooks/qrcode.svg new file mode 100644 index 0000000..b200df3 --- /dev/null +++ b/notebooks/qrcode.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 6b28bf8..7ca0f2e 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -127,7 +127,7 @@ const config = { ], }, ], - copyright: `Copyright © ${new Date().getFullYear()} MeetingMunch, Inc. Built at BaselHack.`, + copyright: `Copyright © ${new Date().getFullYear()} MeetingMunch, Inc. Built with ❤️ at BaselHack.`, }, prism: { theme: lightCodeTheme, diff --git a/website/src/pages/index.js b/website/src/pages/index.js index f62ee99..7cff369 100644 --- a/website/src/pages/index.js +++ b/website/src/pages/index.js @@ -18,7 +18,7 @@ function HomepageHeader() { - Get Started - 5min ⏱️ + Get Started - 1min ⏱️ diff --git a/website/static/img/SVG/justlogo.png b/website/static/img/SVG/justlogo.png new file mode 100644 index 0000000..11afbbf Binary files /dev/null and b/website/static/img/SVG/justlogo.png differ