Skip to main content

Image Sizing

There are several image attributes that you can use to control the size of images in your Paligo topics. You can add the attributes to the imagedata element, and the following sections explain how to set the size values and what results to expect.

Note

What would commonly be called the "height" of an image is called depth as an attribute in Paligo. This is a legacy from DocBook, which Paligo uses as the foundation for the Paligo content model.

For vector images, such as SVG, you should only use contentwidth and contentdepth. These can also be used for certain other use cases, such as if you want spacing around an image, see Examples of Image Sizing.

In most cases, it is better to use the width and depth attributes as they are easier to predict. The contentwidth and contentdepth can produce unexpected (but accurate) results with bitmap images. This is because it is not always possible to determine the intrinsic image size of a bitmap image when processing the output.

Define the image size by using one of the following attributes to the imagedata element:

  • width - sets the width value in relation to the viewport.

  • depth - sets the depth (height) value in relation to the viewport.

  • contentwidth - sets the width value of the image and has no effect on the viewport.

  • contentdepth - sets the depth (height) value of the image and has no effect on the viewport.

  • scalefit - allows an image to be scaled up or down to fit within available space. If scalefit="1" the image is scaled (with the same factor in both dimensions) so that the graphic will just fit within the available height or width (whichever is more constraining). If any other image size attribute is specified, those attributes determine the graphic size and scalefit will be ignored.

The viewport is the available space for the imageobject on the page. Depending on which element that is used on the imagedata element the result will differ. If you set the image:

  • width to 50% - the image will be sized so that it takes up half of the available space on the page.

  • contentwidth to 50% - the image will be reduced to 50% of its original size.

A published Paligo HTML5 output. The page has a navigation bar on the left and a topic area on the right, which takes up most of the space. In the topic area, there is a topic with some text and an image. The image is shown at 50% of the width of the text area.
A published Paligo HTML5 output. The page has a navigation bar on the left and a topic area on the right, which takes up most of the space. In the topic area, there is a topic with some text and an image. The image container is shown at 50% of the width of the text area. The actual image is shown as 50% width of the image container (and so is 25% width of the total content area).

To the left - The image (2) uses 50% of the viewport (1) To the right - The image (2) is reduced to 50% of its original size (1)

Use the Image Size setting to control the resolution of the images in your published HTML5 output. For example, you may want to reduce the resolution so that the image file size is smaller and so the page will load more quickly. The Image Size setting is available when you edit an HTML5 layout.

There are several image attributes that you can use to control the size of images, see Image Sizing.

Note

The Image Size setting affects the resolution (image quality and file size) of the image. It does not change the physical size of the image on the page. For that, you can use the width and contentwidth attributes, which can be set on the mediaobject element of an image.

  1. Select Layout in the top menu.

    Paligo editor. The Layout option in the header menu is highlighted.

    Paligo displays a list of Layouts. The list is empty if there are no custom Layouts in your Paligo instance.

  2. Select the Layout you want to update or Create a Layout.

    Tip

    You can copy the URL of the Layout Editor and paste it into a new tab in your browser. This can be useful if you frequently switch between your Paligo content and the Layout settings.

  3. Select Images in the sidebar.

    Images_Layout_options.jpg
  4. Scroll down to Image size.

    The image size setting on the HTML5 layout. This setting has options for choosing the resolution that will be used for all of the images in your published output.
  5. Select Save.

When you About Publishing the content, the images will be sized based on added attributes and values. You can Preview a Topic to see what the sizing will look like in your different outputs.

Typically, you should only set the width or contentwidth of an image. The depth or contentdepth (height) will automatically be calculated, to keep the image dimensions as the original image file. If you set both width and depth the smallest value of the two is used, and the image is scaled according to that.

There are several other attributes to control width and height. If you want to learn more about the possibilities, see DocBook image sizing reference.

For HTML5 output, you can combine the features Thumbnail Images and Lightbox for Images to get small image versions that are enlarged when selected.

Tip

To keep the SVG functionality in HTML and HTML5:

  • Add the format attribute in Element Attributes Panel and select svg in the dropdown menu.

  • Use contentwidth and contentdepth instead of width and depth.

Format_SVG_small.jpg

To set the image sizing attributes:

  1. Select the topic or component in the Content Manager to open it in the Editor.

    Content Manager in Paligo. It shows the Documents section contains an Acme 100 Topics folder. Inside the folder there is a publication and many topics, including "Connect to Network (100).

    Alternatively, you can Create a Topic and edit that.

  2. Select the image that you want to size.

  3. Select the imagedata in Element Structure Menu and choose Go to element.

    Element-Structure-Menu_Imagedata_small.png
  4. Add the width or contentwidth attribute in the Element Attributes Panel.

  5. Set its value to the desired width in combination with any of the Measurement Units for Image Sizing.

    Width_Element_Attributes_Panel_small.jpg

    By default, if no measurement unit is specified, the sizes are in pixels (px).

  6. Select Save. Save icon.

By default, Paligo uses a nominal width and height when precalculating the percentage scaling of images. This might cause layout shifts for HTML5 Help Center outputs and result in Search Engine Optimization (SEO) issues.

If you enable the Image size attribute for your HTML5 output, Paligo will instead use the actual width and height when precalculating the percentage scaling of images. This makes the webpage load faster and provides a smoother user experience, as it allows the browser to precalculate the page layout more accurately.

To improve Search Engine Optimization (SEO) and the user experience, this setting can be used in combination with the Image size setting to boost site visibility, see Adjust Image Resolution.

Caution

Before you enable Image size attribute, you have to investigate if you have used contentwidth and / or contentdepth when scaling images, see Search for Attributes.

If you have, it is important to consider whether to:

  • Update the scaling for all images after enabling this setting.

  • Replace the above-mentioned attributes with the width attribute before enabling this setting.

  1. Select Layout in the top menu.

    Paligo editor. The Layout option in the header menu is highlighted.

    Paligo displays a list of Layouts. The list is empty if there are no custom Layouts in your Paligo instance.

  2. Select the Layout you want to update or Create a Layout.

    Tip

    You can copy the URL of the Layout Editor and paste it into a new tab in your browser. This can be useful if you frequently switch between your Paligo content and the Layout settings.

  3. Select Images in the sidebar.

    Images_Layout_options.jpg
  4. Scroll down to Image size attribute.

    Image_Size_Attributes.jpg
  5. Select Enable from the menu.

  6. Select Save.

Here are some examples of different image sizing combinations, designed to show you the different effects the sizing attributes can have:

An image of some flowers. The image is centered in the content area.

Attribute contentwidth = 400px. Sets the width of the image itself.

(The value could be 400 or 400px, as "px" is the default if no unit is set.)

An image of some flowers. The image is centered in the content area.

Attribute contentdepth = 400px. Sets the height of the image itself.

An image of some flowers. The image is centered in the content area.

Attribute width = 400px. Sets the width of the viewport of the image, which scales to fit to that area. (The border is not added normally, it is just added here to illustrate the viewport.)

This is the most commonly used attribute for image size.

An image of some flowers. The image is centered in the content area.

Attribute contentdepth = 400px, width = 420px. If the contentdepth or contentwidth is set, and a width or depth attribute is also set, with a higher value, it creates an area around the image.

When you set the value for a width, depth, contentwidth, or contentdepth attribute, you can use any of these units:

px

Pixels are the default unit if none is specified.

pt

Points equals 1/72 of an inch.

cm

Centimeters

mm

Millimeters

pc

Picas equals 1/6 of an inch.

in

Inches

em

Ems (the font size of the current surrounding element)

%

Percentage of the available page area for width  and depth OR original image size for contentwidth and contentdepth.

You may have content that needs to have large images, but these images take up too much space on the page and make it more difficult to read the text. One way to handle this for HTML5 outputs is to use "thumbnails". This is where large images are shown at a much smaller size on the page. If you use Lightbox for Images, readers can click on the thumbnail image to display a larger version.

In Paligo, you can Set All Images as Thumbnails from the HTML5 layout or you can Set Thumbnails for Individual Images.

Paligo HTML output showing a page in the browser. An image is shown at a smaller size than usual. The smaller image is known as a thumbnail.

Thumbnail images are shown at a smaller size on the page

A browser showing a lightbox preview of an image. The lightbox shows the image on a separate dialog at a much bigger size. In this example, the image is of an engine with callout arrows and numbers to label the different parts.

If lightbox is enabled, a user can select a thumbnail image to view it at a larger size

Note

By default the thumbnail will get a rounded border and a max width and height of 200 pixels (px). This can be customized in your CSS.

Tip

If you are publishing to other outputs, such as PDF, you may need to have a specific width on the image too. For this, use the contentwidth attribute instead of width, otherwise the thumbnail feature may not work as intended.

If you want all block images to appear as thumbnails in your HTML5 output, use the Use thumbnails for all mediaobject (block) images setting. This is in the HTML5 layout. This can be useful when you have large images that take up too much space on the page. By setting them as "thumbnail" images, they will appear much smaller. You should also enable the lightbox feature so that end users can select the images to display a larger version.

When you enable the setting and publish, the images will appear as smaller "thumbnail" images. We recommend that you also enable Lightbox for Images so that your readers can select the "thumbnail" images to display a larger version.

Tip

If you only want certain images to appear as thumbnails, see Set Thumbnails for Individual Images.

  1. Select Layout in the top menu.

    Paligo editor. The Layout option in the header menu is highlighted.

    Paligo displays a list of Layouts. The list is empty if there are no custom Layouts in your Paligo instance.

  2. Select the Layout you want to update or Create a Layout.

    Tip

    You can copy the URL of the Layout Editor and paste it into a new tab in your browser. This can be useful if you frequently switch between your Paligo content and the Layout settings.

  3. Select Images in the sidebar.

    Images_Layout_options.jpg
  4. Set the Use thumbnails for all mediaobject (block) images to:

    • Enable if you want all block images to appear as thumbnails.

    • Disable if you do not want all block images to be thumbnails.

    Layout setting. There is a box containing a Use thumbnails for all mediaobject (block) images setting. It is a dropdown and is set to Enable.
  5. Select Save.

You can set individual images to be shown as a thumbnail image instead of at full size. This is useful if you only want to use the thumbnail feature for certain images, such as images that are especially large.

Tip

If you want most, but not all, images to use thumbnails it may be quicker to Set All Images as Thumbnails and exclude some images from using thumbnails by adding a role attribute to the mediaobject element and with the value set to img-thumbnail-reset.

To use the thumbnail feature for individual images:

  1. Select Layout in the top menu.

    Paligo editor. The Layout option in the header menu is highlighted.

    Paligo displays a list of Layouts. The list is empty if there are no custom Layouts in your Paligo instance.

  2. Select the Layout you want to update or Create a Layout.

    Tip

    You can copy the URL of the Layout Editor and paste it into a new tab in your browser. This can be useful if you frequently switch between your Paligo content and the Layout settings.

  3. Select Images in the sidebar.

    Images_Layout_options.jpg
  4. Set Use thumbnails for all mediaobject (block) images to default or Disable.

    Layout setting. There is a box with a Use thumbnails for all mediaobject (block) images setting. It is a dropdown and is set to Disable.
  5. Enable Use Lightbox for images to allow users to click on your thumbnail image to display it at a larger size.

    Layout setting. There is a Use Lightbox for images box. Inside it, there is a single dropdown menu and it is set to Enable.
  6. Select Save.

  7. Select the topic or component in the Content Manager to open it in the Editor.

    Content Manager in Paligo. It shows the Documents section contains an Acme 100 Topics folder. Inside the folder there is a publication and many topics, including "Connect to Network (100).

    Alternatively, you can Create a Topic and edit that.

  8. Select the image in the content.

  9. Either:

    1. Select Insert.

    2. Select Image.

    3. Select Make thumbnail.

      Paligo will resize your image in the editor, although it may not be shown as a thumbnail. When you publish, it will be shown as a thumbnail image in the output.

    or:

    1. Select the image's mediaobject element in Element Structure Menu and choose Go to element.

    2. Add the role attribute Element Attributes Panel and set its value to img-thumbnail.

      Element attributes section. It shows the mediaobject is selected and it has a role attribute. The value of the role attribute is img-thumbnail.

      Tip

      If you already have a role attribute on the mediaobject, separate the values with a semi-colon.

  10. Select Save. Save icon.

When you publish your content, Paligo will display the image as a thumbnail. Your users can select the thumbnail to view a larger version (as long as you have enabled the lightbox feature on your Layout, see step 5).