8.6.1.6 Insert Images from File, Web URL, or Worksheet Cells

Beginning with Origin 2022b, you can insert images from file, a Web URL or from a worksheet cell.

UG InsertImage to text label.png

Inserting Images from File or Web

You can insert images from an image file or a Web URL, into a text object. In either case, images are linked rather than embedded, which means that (a) project size is kept to a minimum and (b) if/when images are changed, the inserted image is also updated.

  1. On the Tools toolbar, click the Text tool Button Text Tool.png and click once on the graph to enter "in-place" edit mode; or right-click on the graph and choose Add Text from the shortcut menu.
  2. Enter text if needed and when ready to insert image, right-click and choose Insert: Image from File or Image from Web:
    • When inserting an image from file, browse to your local image file and click Open.
    • When inserting an image from Web, you'll need a URL (hint: locate your Web image, then right-click and copy the address using Copy Image Address, Copy Image Link, etc.).

To examine (or modify) the syntax used for inserting an image, you can select the inserted object and choose Properties. In the Text Object dialog, you should see something like these examples:

Examples:

\img(file://"C:/Program Files/OriginLab/Origin2022b/Samples/Image Processing and Analysis/white camellia.jpg",w=200) 
\img(https://www.originlab.com/images/header_logo.png, w=200)

... where option "w=" is the default width in pixels, of the inserted image. Width is user-modifiable by editing the "w=" value in Properties or -- if no width is specified -- by simply dragging the object's selection handles.

Inserting Graph and Table

You can pass
\img(Graph1)
or
\img([book1]sheet1)
to insert Graph or Worksheet table.

Inserting Images from a Worksheet Cell

You can also insert an image from a worksheet cell into a text object, but as there is no menu option for adding, you'll need to make use of a special syntax. The syntax is not complicated and combines a \cell( ) escape sequence with a cell reference -- either a range reference (e.g. [Book1]Sheet1!col(C)[1]) or a named range reference.

  1. On the Tools toolbar, click the Text tool Button Text Tool.png and click once on the graph to enter "in-place" edit mode; or right-click on the graph and choose Add Text from the shortcut menu.
  2. Enter your string into the text object using the examples below as a guide:
    • If you are copying and pasting a string (e.g. \cell([Book1]Sheet1!B[1])), click outside the text object to leave edit mode. Your cell image should display in the text object.
    • If you are typing directly into the text object in "in-place" mode, enter your syntax (e.g. \cell([Book1]Sheet1!B[1])) and when finished, right-click on the object, choose Properties and on the Text tab, remove one of the leading "\" characters from your cell reference (Origin automatically "protects" "\" characters entered into text objects which is why you'll need to remove one "\". See Escape Sequences).
    • If you are typing directly into the Text Object (Properties) dialog, enter your syntax (e.g. \cell([Book1]Sheet1!B[1])) directly to display the cell image.


Examples:

\cell([Book1]1!col(C)[2]) // Book1, Sheet1, col C, row2, size = current font height
\cell(alpha,200) // named range "alpha", width=200 logical pixels
\cell(alpha,h=300) // named range "alpha", height=300 logical pixels