pandoc-3.2.1: Conversion between markup formats
CopyrightCopyright (C) 2011-2024 John MacFarlane
LicenseGNU GPL, version 2 or above
MaintainerJohn MacFarlane <jgm@berkeley.edu>
Stabilityalpha
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Text.Pandoc.ImageSize

Description

Functions for determining the size of a PNG, JPEG, or GIF image.

Synopsis

Documentation

data ImageType Source #

Constructors

Png 
Gif 
Jpeg 
Svg 
Pdf 
Eps 
Emf 
Tiff 

Instances

Instances details
Show ImageType Source # 
Instance details

Defined in Text.Pandoc.ImageSize

data ImageSize Source #

Constructors

ImageSize 

Fields

Instances

Instances details
Read ImageSize Source # 
Instance details

Defined in Text.Pandoc.ImageSize

Show ImageSize Source # 
Instance details

Defined in Text.Pandoc.ImageSize

Default ImageSize Source # 
Instance details

Defined in Text.Pandoc.ImageSize

Methods

def :: ImageSize #

Eq ImageSize Source # 
Instance details

Defined in Text.Pandoc.ImageSize

sizeInPoints :: ImageSize -> (Double, Double) Source #

Calculate (height, width) in points using the image file's dpi metadata, using 72 Points == 1 Inch.

desiredSizeInPoints :: WriterOptions -> Attr -> ImageSize -> (Double, Double) Source #

Calculate (height, width) in points, considering the desired dimensions in the attribute, while falling back on the image file's dpi metadata if no dimensions are specified in the attribute (or only dimensions in percentages).

data Dimension Source #

Instances

Instances details
Show Dimension Source # 
Instance details

Defined in Text.Pandoc.ImageSize

Eq Dimension Source # 
Instance details

Defined in Text.Pandoc.ImageSize

data Direction Source #

Constructors

Width 
Height 

Instances

Instances details
Show Direction Source # 
Instance details

Defined in Text.Pandoc.ImageSize

dimension :: Direction -> Attr -> Maybe Dimension Source #

Read a Dimension from an Attr attribute. `dimension Width attr` might return `Just (Pixel 3)` or for example `Just (Centimeter 2.0)`, etc.

scaleDimension :: Double -> Dimension -> Dimension Source #

Scale a dimension by a factor.

numUnit :: Text -> Maybe (Double, Text) Source #

Maybe split a string into a leading number and trailing unit, e.g. "3cm" to Just (3.0, "cm")

showInInch :: WriterOptions -> Dimension -> Text Source #

Convert a Dimension to Text denoting its equivalent in inches, for example "2.00000". Note: Dimensions in percentages are converted to the empty string.

showInPixel :: WriterOptions -> Dimension -> Text Source #

Convert a Dimension to Text denoting its equivalent in pixels, for example "600". Note: Dimensions in percentages are converted to the empty string.