Issue on exporting a simple image object

Please consider the code below (this is a simpler version of the original problem)

w = 100.;
l = 150.;
pi = {{-.5 w - l, .5 l}, {-.5 w, .5 l + w}};
reti = Rectangle[pi[[1]], pi[[2]]];
gr = Graphics[{reti}];
Export["~/black_rectangle.gif", gr] 

The created image has a white space framing the rectangle. How to export
an image of a totally black rectangle? Thanks in advance

Try

gr = Graphics[reti, PlotRangePadding -> 0]

That eliminated the extra white space for me. If that does not work for your system, try PlotRangePadding -> -1 then it should work.