Background Image in scatter plot

I am trying to add background to my scatterplot, but the background should be limited to just the pad, I tried working based on below documentation,
https://root.cern/doc/master/img2pad_8C.html

But my original image get cropped. I didn’t quiet figure out about the x, y coordinate used in pad.

    TImage *img = TImage::Open("file1545.jpg");
    img->SetConstRatio(kFALSE);
    float d  =0.40;
    TCanvas* maincanvas = new TCanvas("maincanvas","img",1080,1920);
    // TPad *p1 = new TPad("i1","i2",0.05,0.55,0.05+d*img->GetWidth()/img->GetHeight(),0,95);
    // TPad *p2= new TPad("i1","i2",0.05,0.55,0.05+d*img->GetWidth()/img->GetHeight(),0,95);
    TPad *p1 = new TPad("i1","i2",0.05,0.55,0.9,0.9);
    TPad *p2= new TPad("i1","i2",0.05,0.55,1.0,1.0);
    p2->SetFillStyle(4000);
    p2->SetFillColor(0);
    p2->SetFrameFillStyle(0);
    p2->SetFrameFillColor(0);
    p1->Draw();
    p1->cd();
    img->Draw();
    maincanvas->cd();
    p2->Draw();
    p2->cd();

https://root.cern/doc/master/classTPad.html#a76f817b43002e1e9e07a317ed84ac933

Thank You for help.
But, even with changing the x-coordinate and y-coordinate it still change shape of image.

Can you post file1545.jpg so we can try your macro ?

Thank You for the response,
The problem comes from different definitions of pixel coordinates. In Computer Vision, conventionally, y-coordinate starts from the top left since they deal with points/pixels on a monitor, whereas, we use the standard convention that the y-axis starts from the bottom left and increases to the top left.
The issue was solved by the following modification,

 hist->Fill(x_coordinate,1080-y_coordinate,radius);