<pre data-lang="python" data-label="python">import libstb as stb

img = stb.Image.open("photo.jpg", orient=True)      # apply the EXIF orientation
small = img.resize(320, 240, "cubic")               # filter by name
gray = small.convert(1)                             # editing returns a new Image
gray.write("photo_gray.png")                        # format from the extension

pixels = stb.imread("photo.png")                    # ndarray (needs numpy)
stb.imwrite("out.jpg", pixels, quality=80)

stb.Font.open("font.ttf").render("Hi", 32).bitmap.write("hi.png")</pre>
