Resolution Included in Image Files

This section provides a tutorial example to demonstrate the logic used by XSL processors to determine to determine the image display resolution. Resolution information included in the image file will be respected, if 'scale-to-fit' is not specified.

Another factor to consider when managing graphics resolution is the resolution information included in the graphics file itself. Here is the common logic an XSL processor follows to determine the final resolution:

Let's assume that I have a tangram image of 120x120 pixel stored in 2 files: Tangram-120-DPI.jpg with 120 DPI resolution properties included, and Tangram-No-DPI.gif with no resolution properties included. Here is my tutorial example,, that displays the tangram image with different attributes:

<?xml version="1.0" encoding="utf-8"?>
 - Copyright (c) 2016,, All Rights Reserved.
<fo:root xmlns:fo="">
  <fo:simple-page-master master-name="page" 
   margin="0.1in" page-height="6in" page-width="3.5in">
   <fo:region-body region-name="body" background-color="#eeeeee"/>
 <fo:page-sequence master-reference="page">
  <fo:flow flow-name="body">
    <fo:block-container width="1in" border-width="1px"
     <fo:block>1 inch</fo:block>
    <fo:block-container width="72px" border-width="1px" 
     <fo:block>72 px</fo:block>
    <fo:block-container width="120px" border-width="1px" 
     <fo:block>120 px</fo:block>
   <fo:block-container border-width="1px" border-style="solid">
    <fo:block>Resolution overridden: 144 DPI</fo:block>
     <fo:external-graphic width="0.83in" height="0.83in" 
      content-width="scale-to-fit" content-height="scale-to-fit"
   <fo:block-container border-width="1px" border-style="solid">
    <fo:block>Resolution from image file: 120 DPI</fo:block>
     <fo:external-graphic src="url('Tangram-120-DPI.jpg')"/>
   <fo:block-container border-width="1px" border-style="solid">
    <fo:block>Resolution from default: ? DPI</fo:block>
     <fo:external-graphic src="url('Tangram-No-DPI.gif')"/>

If you process this example XSL-FO document with Apache FOP tool, you should see the tangram image displayed 3 times in different sizes:

"external-graphic" Resolution Rules - Apache FOP

Note that:

Exercise: process this example XSL-FO document with RenderX XEP tool to see the impact of XSL processor default resolution on the third tangram.

Last update: 2016.

Table of Contents

 About This XSL-FO Tutorial Book

 Introduction of XSL-FO

 Apache™ FOP (Formatting Objects Processor)

 RenderX XEP as an XSL-FO Tool

 Introduction of Area Model

 XSL-FO Document Basics and Examples

 Page Layout Masters

 Block-Level Formatting Objects

 Inline-Level Formatting Objects

Including Graphics in XSL-FO document

 What Is "external-graphic" Formatting Object?

 Control DPI with "content-width" and "content-height"

 Fixed Higher DPI with "scale-to-fit"

Resolution Included in Image Files

 Image Over and Under Flow Area

 "external-graphic" with SVG Diagram

 "instream-foreign-object" Formatting Object

 Table of Rows and Columns

 List, Item, Label, and Body

 Floating Blocks - "float" and "footnote"

 Hyperlinks, Table of Contents and Indexes

 Headers and Footers using "static-content"

 Font Attributes and Font Families

 Apache FOP Font Configurations

 RenderX XEP Font Configurations


 PDF Printing Version