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

Last Update: 12/5/2024

Origin 2025 and Later

  1. With the graph window active, choose Insert: Image from File to insert it into the graph.
  2. Right-click on the inserted image and select Set as Layer Background.


A couple things to note:

  • After setting the image as Layer Background, the image window can only be opened from the Object Manager. Make sure to be in Show Graph Objects mode, then the image can be controlled either by double-clicking "Layer Background" (or right-click and select 'Properties...').

LayerBackgroundProperties.png

  • Since the image is set as the Layer Background, resizing the layer will make the image resize/clip with the axis scales.

Origin 2022 to 2024b

  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