def to_png(self, *args, **kwargs): image_wrapper = self._original_to_png(*args, **kwargs) image = image_wrapper.get_image() new_width = helpers.pt_to_px(image_wrapper.get_width()) new_height = helpers.pt_to_px(image_wrapper.get_height()) image_wrapper.image = image.resize((new_width, new_height), Image.ANTIALIAS) #image_wrapper.scale_parameters(1.0/ANTIALIASING) return image_wrapper
def pt_to_px(self, points): """Mapping :function:`pt_to_px` from :mod:`sdgen.lib.helpers`. Result of this method can be modified by setting antialiasing decorator on class. """ return helpers.pt_to_px(points)
def _get_font(self, font_type, size, typeface): """Get font with given parameters.""" font_path = helpers.get_font_path(font_type, typeface) if font_path: return ImageFont.truetype(font_path, helpers.pt_to_px(size)) return ImageFont.load_default()
def pt_to_px(self, points): """ Converts points to pixels. .. deprecated:: 0.0.3 Use :func:`helpers.pt_to_px` directly instead. """ return helpers.pt_to_px(points)