You can merge publicly available images on your document:

  1. You can copy and paste any image directly into your template (including header and footer), that will be visible on every generated document.
  2.  You can also create a URL type field on master object to merge an image field. Use this field to enter URL of the image that you want to show on the document.
    1. You can also upload the image to Documents tab in Salesforce and copy and paste the link. Make sure you check the box Externally Available.
    2. You can paste the link to any externally available image, from your server, WordPress Media library etc.   
  3. From your Document Action click “Edit Template Document” to edit the template.
  4. Open object record and paste the copied image URL value in this field.
  5. From your Document Action click “Edit Template Document” to edit the template.
  6. Select the object and image field.
    1. If you want to learn more about using images from Files, see this article for more detail.
  7. Check the “Image” box then copy and paste Merge Field Code onto your template.

The field will be displayed as an image on your newly generated Document:

Options for using merging images into your template:
In order to merge images onto a document you need a URL to the direct image that is available to the public. If you have a file in Documents in Salesforce, you can make the document available externally and can merge this URL. You can also upload images to google drive or can have images on any web server or cloud server as long as you get back a URL that you can enter in a browser to see the image. You could create some apex that would copy files/attachments to documents and save urls to those images in object related list or on base object being used in document action to then make available to merge.

Additional Image Configurations:

  1. Image Size: If merging an image field into a single table cell (or into template by itself from parent object), the table will get resized to it’s actual image size after document gets generated. If you want to restrict the width size of the image, you can review this article for more detail.
  2. Formula Field to merge Images: It’s possible to insert images in a formula field using URL.
    Check this article for reference: