# How to avoid margin when combining ListDensityPlot and an Image?

I have an image img1 and some data with a density plot plot1 to reflect the target position of the image. I tried to combine img1 and plot1 as below:-

targetPosition = BlockRandom[SeedRandom[123]; RandomReal[100, {35, 50}]];
img1 = ImageCrop[ExampleData[{"TestImage", "Airport"}], {1000, 700}];
plot1 = ListDensityPlot[Exp@targetPosition,
AspectRatio -> ImageAspectRatio@img1, PlotRange -> All,
ImageSize -> ImageDimensions[img1], Axes -> False, Frame -> None];


As you can see, there's still a margin here. Thus the position will have errors due to the margin. How can I get rid of the margin?

Many thanks!

• This problem is quite similar to your previous one from a few days ago, which was solved by using GeoRangePadding -> None... – MarcoB Jun 20 '18 at 3:28
• Yes. Thus I was thinking the trick should be some Padding options at ImageAdd. I now realized that the Padding option should be set in ListDensityPlot. Many thanks. – H42 Jun 20 '18 at 3:37

Adding PlotRangePadding -> 0 to ListDensityPlot gives
• Thanks. I was stuck in the options of ImageAdd. Now it is solved! – H42 Jun 20 '18 at 3:04