# 1.264 FAQ-1068 How to insert a graph background image and link to layer scales?

Last Update: 9/7/2020

Origin has an X-Function named insertImg2g that is used to insert images into graph windows. While implemented primarily to support Origin's Google Map Import App, you can use it on its own to insert a raster image into the background of any graph and lock the image to the containing layer's scales.

1. Once you import the image, any change in axis scales will crop the image so adjust axis scales beforehand if need be.
2. Open the Script Window (Window: Script Window), enter the following two lines of code, then highlight both of them and press Enter:
dlgfile g:="*.PNG"; // can substitute any supported raster file type for .PNG
insertImg2g type:=img xyp:=2;
3. An Open dialog will prompt you to pick your image file. Click OK and the image will be inserted into the graph background with the following characteristics:
• Image is placed behind data and is NOT selectable.
• Image attached to layer and scales in stretch mode.
• Image dimensions same as layer axis scale range.

Keywords:raster, insert image, layer and scales, object attachment