Could TImage::FromPad only get the picture in a Framework?

Could TImage::FromPad only get the picture in a Framework
TH1F * h1 = c1->DrawFrame(…)
TGraph * g1 …
g1->Draw(“same”);

I want to get the image only in the Frame TH1 without magrin outside

FromPad has a TVirtualPad as parameter.
A TCanvas is a TPad/TVirtualPad.

I didn’t Explain clearly,

I could get the TCanvas all in TPad

But I want use TImage::FromPad(c1, a, b, c, d);

how could I calculate a, b, c, d?

You can ignore them and use the default values.