Image

class pdfpug.modules.Image(path, **kwargs)

Embed picturesque visuals using the Image class with different styles

Parameters:
  • path (str) – Absolute path of image
  • size (Optional[Size]) – Size of image
  • style (Optional[ImageStyle]) – Render style
  • layout (Optional[ImageLayout]) – Layout options

Instantiating an image is as simple as the following,

>>> from pdfpug.modules import Image
>>> img = Image('/home/johndoe/image.png', size=Size.small, style=ImageStyle.rounded)
../_images/rounded_image.png
class pdfpug.modules.Images(images, **kwargs)

Embed a row of images together using the Images class.

Parameters:
  • images (List[Image]) – Group of images
  • size (Optional[Size]) – Common size of group images
>>> from pdfpug.modules import Image, Images
>>> images = Images(
...     [
...         Image('/home/johndoe/image1.png'),
...         Image('/home/johndoe/image2.png'),
...         Image('/home/johndoe/image3.png')
...     ],
...     size=Size.small
... )
../_images/images.png
class pdfpug.common.ImageStyle

Enum Image Style

avatar = 'avatar'

Image which appears inline as an avatar (circular image)

../_images/avatar_image.png
rounded = 'rounded'

Image with rounded edges

../_images/rounded_image.png
circular = 'circular'

Crop image into a circular shape. The input image should have the same width and height for this style to work.

../_images/circular_image.png
class pdfpug.common.ImageLayout

Enum Image Layouts

left_float = 'left float'

Float to the left of neighbouring content

right_float = 'right float'

Float to the right of neighbouring content

centered = 'centered'

Horizontally center the image