Home | News | Documentation | Download

Canvas scaling when saving

This is a feature request mail.

Would it be possible to add an option to TPad::SaveAs(), when saving to non-vector formats, such as png, a scaling option? I mean, I have 300x300 canvas. When I save it, png has a 300x300 size. I’d like to save exactly the same canvas, but, for example, twice bigger. So this would be something like SaveAs(“something.png”, 2, 2);

I know I can resize the canvas and then save it, but it often requires resizing, for example, markers. Additionally I know I can save to a vector format such as eps or pdf, then convert it to png of any size, but… well, with such a scaling option it would be much simpler.

You can also make a small macro which:

  • enter Batch mode,
  • make a canvas twice bigger,
  • make a copy of the original in it,
  • print this copy,
  • close the batch canvas,
  • and finally exit the batch mode.

What do you mean by batch mode? Just root -b, or using TCanvas::SetBatch? In the second case, I have no idea what this function really does :slight_smile:

And by copy, do you mean c1->Copy(*c), for original canvas c1 and new c?

yes TCanvas::SetBatch
After this call all the graphics is done in background.
Not visible on screen.