kopia lustrzana https://github.com/hholzgra/ocitysmap
reduce PNG resolution when pixel width or height of the image
gets too close to CairoGraphics limitsdev-multipage-gpx
rodzic
b3be9bc98d
commit
7037e1be15
|
|
@ -483,6 +483,14 @@ SELECT ST_AsText(ST_LongestLine(
|
|||
except configparser.NoOptionError:
|
||||
dpi = OCitySMap.DEFAULT_RENDERING_PNG_DPI
|
||||
|
||||
w_px = int(layoutlib.commons.convert_mm_to_dots(config.paper_width_mm, dpi))
|
||||
h_px = int(layoutlib.commons.convert_mm_to_dots(config.paper_height_mm, dpi))
|
||||
|
||||
if w_px > 25000 or h_px > 25000:
|
||||
LOG.warning("%d DPI to high for this paper size, using 72dpi instead" % dpi)
|
||||
dpi = layoutlib.commons.PT_PER_INCH
|
||||
|
||||
|
||||
# As strange as it may seem, we HAVE to use a vector
|
||||
# device here and not a raster device such as
|
||||
# ImageSurface. Because, for some reason, with
|
||||
|
|
|
|||
|
|
@ -32,5 +32,8 @@ def convert_pt_to_dots(pt, dpi = PT_PER_INCH):
|
|||
def convert_mm_to_pt(mm):
|
||||
return mm / MM_PER_INCH * PT_PER_INCH
|
||||
|
||||
def convert_mm_to_dots(mm, dpi = PT_PER_INCH):
|
||||
return float(convert_mm_to_pt(mm) * dpi) / PT_PER_INCH
|
||||
|
||||
def convert_pt_to_mm(pt):
|
||||
return float(pt) * MM_PER_INCH / PT_PER_INCH
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue