Let us make a simple Graphics with Scaled ImagePadding specification and check the actual absolute paddings of the result:

ip = {{Scaled[0.01], Scaled[0.01]}, {Scaled[0.01], Scaled[0.01]}};

g1 = Graphics[{Rectangle[Scaled[{0, 0}], Scaled[{1, 1}]]}, ImageSize -> {1000, 100},
AspectRatio -> Full, ImagePadding -> ip, Axes -> False, Background -> Yellow] I'm most interested in PDF export, so I check the coordinates of the bottom-left and upper-right corners of the yellow and black rectangles in the exported PDF file:

Cases[ImportString[ExportString[g1, "PDF"], "PDF"],
fc_FilledCurve :> fc[[2, 1, {1, 3}]], -1] // Column

{{0., 0.}, {1000., 100.}}
{{3.953, 96.047}, {996.047, 3.953}}


We expectedly have got the yellow rectangle with size 1000×100 printer's points (pt), but the coordinates of the black rectangle are hard to understand: it has offset 3.953 pt from every side (relative to yellow rectangle) while we requested the offset 1% of the plotting range from every side. The size of the plotting range must be equal to the size of the black rectangle, and in the exported PDF the latter has {width, height} equal to

{996.047 - 3.953, 96.047 - 3.953}

{992.094, 92.094}


printer's points, so 1% of it would be

%*0.01

{9.92094, 0.92094}


printer's points.

So there are two inconsistencies:

1. The horizontal and vertical offsets in PDF are equal while they should be different

2. Both offsets do not equal to requested 1% of the plotting range

In principle it is possible to live with this, but I need to understand how the final paddings are calculated in order to get predictable result.

It is worth to note that the graphicsInformation function by Carl Woll also returns equal horizontal and vertical paddings, and they are close to 1% of the horizontal plotting range:

graphicsInformation[g1]

{"ImagePadding" -> {{10.1067, 10.1067}, {10.1067, 10.1067}},
"ImageSize" -> {1000., 100.},
"PlotRangeSize" -> {979.787, 79.7867},
"PlotRange" -> {{-1.04167, 1.04167}, {-0.999999, 0.999999}}}


But they differ from what FrontEnd renders on the screen:

imageSize = ImageDimensions[g1]
plotRangeSize = ImageDimensions[ImageCrop[g1]]
(imageSize - plotRangeSize)/plotRangeSize // N

{1000, 100}

{991, 91}

{0.00908174, 0.0989011}


Here the paddings again are equal, but the full horizontal padding (0.908% of the plotting range) is close to a half of 2% (1% from the left and 1% from the right). The horizontal plotting range size 991 differs significantly from what graphicsInformation return (979.787).

How the paddings in the PDF file are calculated? Is it possible to make them consistent with what is displayed on the screen?