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

Last Update: 2/2/2024

Origin 2022 and Later

  1. With the graph window active, choose Insert: Image from File and open your image file.
  2. Double-click the inserted image to open it in a separate Image Window.
  3. Right-click on the image in the Image Window and select Set as Layer Background.

Origin 2021b

  1. With the graph window active, choose Insert: Image from Files. An attention message asks Do you want to insert as layer background?
    • Answering Yes will insert as a background image linked to layer scales. The image will NOT be selectable.
    • Answering No will simply insert the image as an object on the graph page. You can select it, move or resize it, or modify it via its Properties dialog box.

Origin 2021 and Earlier

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