Skip to content

Instantly share code, notes, and snippets.

View charlsagente's full-sized avatar

Carlos Perez charlsagente

View GitHub Profile
@charlsagente
charlsagente / svgsurf.py
Created March 1, 2019 04:36 — forked from zgoda/svgsurf.py
Load svg into Pygame image using pynanosvg (https://github.com/ethanhs/pynanosvg)
from svg import Parser, Rasterizer
def load_svg(filename, scale=None, size=None, clip_from=None, fit_to=None):
"""Returns Pygame Image object from rasterized SVG
If scale (float) is provided and is not None, image will be scaled.
If size (w, h tuple) is provided, the image will be clipped to specified size.
If clip_from (x, y tuple) is provided, the image will be clipped from specified point.
If fit_to (w, h tuple) is provided, image will be scaled to fit in specified rect.
@charlsagente
charlsagente / camera.py
Last active August 11, 2019 02:09
Raspberry Pi Camera
# Take still pictures with Python
from picamera import PiCamera
from time import sleep
camera = PiCamera()
camera.rotation = 180 # You can rotate the image by 90, 180 or 270 degrees
camera.start_preview() # Make the camera preview
for i in range(5):