Maximum canvas size in pixels


I try to plot a canvas with hundreds of histograms and save it as .png file. The width of the canvas is set to 1270 and the height depends on the histogram number. I have spotted that the final .png plot cannot have the height > 32000. If it would be bigger, some of the histograms will be missing in the plot. 32000 seems to be maximum canvas height in pixels.

My questions are: what is the origin of this maximum value and is it possible to create a plot with height more than 32000 pixels? Thank you.

Best regards,

I cannot answer your question (maybe @bellenot or @couet can) but reading your post I cannot help but wonder whether it wouldn’t be more practical for you to save several different png images and only merge them together in a second step (with an external tool like gimp or imagemagick) if you really need it.

You can try in batch mode (to avoid X11 errors), but you might have memory issues anyway… I would suggest to follow what @eguiraud suggested

Hi Guys,

thanks for the fast response. The plot should be created automatically after each run - it is an output of the online data taking in the experiment.

I might try to do what Enrico has suggested skipping the second step, if no solution will be found.

Thanks anyway,

Note that merging of png’s can easily done programmatically. For example (just because this is what I know, not saying it’s the best solution)

convert image1.png image2.png output.pdf

concatenates the png images into a pdf file.
Good luck,

seems fine in batch mode

$ root -b
  | Welcome to ROOT 6.11/01            |
  |                                    (c) 1995-2017, The ROOT Team |
  | Built for macosx64                                              |
  | From heads/master@v6-09-02-1537-ge08851a, Jun 30 2017, 14:41:02 |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'      |

root [0] TCanvas *c = new TCanvas("c","c",1270,32000)
(TCanvas *) 0x7f9c7496b4f0
root [1] hpx->Draw()
root [2] c->Print("bigcanvas.png");
Info in <TCanvas::Print>: png file bigcanvas.png has been created

Hi Olivier,

yes I can confirm, it works in batch mode for me as well. Thank you vey much for your help!


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.