I am refreshing this old topic because I have exact same issue:
Let’s start with this simple macro:
demo.C (113 Bytes)
{
auto can = new TCanvas("can", "can", 400, 400);
can->SetWindowSize(800, 800);
can->SaveAs(".C");
}
When run: root demo.C the saved canvas is:
//=========Macro generated from canvas: can/can
//========= (Tue Feb 3 12:30:06 2026) by ROOT version 6.38.00
TCanvas *can = new TCanvas("can", "can", 3000, 360, 800, 800);
but when called in batch mode root -b demo.C:
//=========Macro generated from canvas: can/can
//========= (Tue Feb 3 12:30:55 2026) by ROOT version 6.38.00
TCanvas *can = new TCanvas("can", "can", 0, 0, 400, 400);
Any ideas how to save changes in batch mode?
..:: edit: to be presiely as also written below, the canvas saved in batch mode does not preserve the canvas size as seen in tehse two lines:
TCanvas *can = new TCanvas("can", "can", 3000, 360, 800, 800); // window mode
TCanvas *can = new TCanvas("can", "can", 0, 0, 400, 400); // batch mode