<div dir="ltr">Hi Devs,<div><br></div><div>I've looked into the code and the problem described in the mail below still persists and the image being drawn by cairo/pdf and cairo/svg is incorrect.</div><div>To summarize the things, the width and height passed to <a href="http://cairographics.org/manual/cairo-PDF-Surfaces.html#cairo-pdf-surface-create" target="_blank">cairo_pdf_surface_create</a> or <a href="http://cairographics.org/manual/cairo-SVG-Surfaces.html#cairo-svg-surface-create" target="_blank">cairo_svg_surface_create</a> should be in points (1 point == 1/72.0 inch) which is not the case at the moment we are passing the width and heights in pixels therefore we get a different image when rendering the same with the cairo/png format.</div><div><br></div><div>Is this considered as a bug that should be corrected in MapServer?</div><div><br></div><div>Thanks,</div><div><br></div><div>Tamas</div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">2014-11-04 22:11 GMT+01:00 Tamas Szekeres <span dir="ltr"><<a href="mailto:szekerest@gmail.com" target="_blank">szekerest@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Devs,<div><br></div><div>We may experience a difference regarding to the (visual) image size when saving the map to pdf vs png. The problem is already described in the following issue: </div><a href="https://github.com/mapserver/mapserver/issues/4487" target="_blank">Cairo SVG and PDF output larger than PNG</a> which is related to the pdf/svg canvas where the size is specified in points and not in pixels. That means: each point has a fixed size of 1/72 inches regardless of the device used.<div><br></div><div>Our problem here is that we pass the image size directly to <a href="http://cairographics.org/manual/cairo-PDF-Surfaces.html#cairo-pdf-surface-create" target="_blank">cairo_pdf_surface_create</a> or <a href="http://cairographics.org/manual/cairo-SVG-Surfaces.html#cairo-svg-surface-create" target="_blank">cairo_svg_surface_create</a> which is incorrect. We should rather pass </div><div>72.0 / map->resolution * map->width and 72.0 / map->resolution * map->height respectively. And we should also set map->resolution to 72 before the image is drawn to let the symbols scale with the image size correctly.</div><div><br></div><div>My question is what would be the correct handling for this in MapServer?</div><div><br></div><div>1. Don't do anything in MapServer let the client programs (like mapscript applications) to change the image size and scale.</div><div>2. Apply these corrections at the beginning of msDrawMap (for the pdf/svg renderers specifically) and restore the original values at the end of the drawing operation.</div><div>3. Apply these corrections at driver level (createImageCairo etc.)</div><div><br></div><div>For me #2 seems to be the most reasonable approach (with just a few lines of code). </div><div>#1 would not help for the existing apps (mapserv, shp2img) which should be fixed separately. And I cannot really see how #3 would work, since the image size and resolution is not wired directly into the drivers (createImage doesn't get the resolution for example).</div><div><br></div><div>Any ideas or alternatives?</div><div><br></div><div>Thanks,</div><div><br></div><div>Tamas</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>
</blockquote></div><br></div></div>