# TCanvas::Print PNG outputs fraction of figure when canvas size is declared

**URL:** <https://root-forum.cern.ch/t/tcanvas-print-png-outputs-fraction-of-figure-when-canvas-size-is-declared/26011>\
**Category:** ROOT\
**Tags:** graphics\
**Created:** [August 24, 2017, 8:13pm UTC](https://root-forum.cern.ch/t/tcanvas-print-png-outputs-fraction-of-figure-when-canvas-size-is-declared/26011 "2017-08-24T20:13:21Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [August 24, 2017, 8:55pm UTC](https://root-forum.cern.ch/t/tcanvas-print-png-outputs-fraction-of-figure-when-canvas-size-is-declared/26011/2 "2017-08-24T20:55:02Z")

</div>

> [@SetBatch causes different graphics output for pngs](https://root-forum.cern.ch/t/setbatch-causes-different-graphics-output-for-pngs/19682/8):
>
> I’m afraid [TCanvas::SetWindowSize](https://root.cern.ch/root/html534/TCanvas.html#TCanvas:SetWindowSize) is completely unreliable (it can misbehave even in interactive mode). When I try (ROOT 5.34 and 6.04.02): { Int\_t w = 800; Int\_t h = 600; TCanvas \*c; gROOT-\>SetBatch(kFALSE); c = new TCanvas("c", "c", w, h); c-\>Modified(); c-\>Update(); std::cout \<\< c-\>GetWw() \<\< " " \<\< c-\>GetWh() \<\< std::endl; c-\>SetWindowSize(w + (w - c-\>GetWw()), h + (h - c-\>GetWh())); c-\>Modified(); c-\>Update(); std::cout \<\< c-\>GetWw() \<\< " " \<\< c-\>GetWh() \<\< std::endl; …

> [@Print / saveas png draws axis title twice with offset](https://root-forum.cern.ch/t/print-saveas-png-draws-axis-title-twice-with-offset/19142/7):
>
> I am able to reproduce this problem on my Ubuntu 14.04. It is related to two lines in the “rootlogon.C”: gStyle-\>SetCanvasDefH(RequestedH); gStyle-\>SetCanvasDefW(RequestedW); As soon as “RequestedH” and/or “RequestedW” exceed physical dimensions of my screen, I also get “spurious” contents in the “bottom” and/or “right” side in the “test1.png” file (but not in another saved pictures and not on the screen). I can clearly see that, when the “png\_double\_x\_axis\_title” macro starts, ROOT opens a…

---

_[View the full topic](https://root-forum.cern.ch/t/tcanvas-print-png-outputs-fraction-of-figure-when-canvas-size-is-declared/26011)._
