Skip to contents

Reads the width of a PNG in pixels from the start of the file, where every PNG keeps it: bytes 17 to 20, after the signature of the format and the length and the name of its first chunk, IHDR.

Usage

png_width(file)

Arguments

file

A PNG file.

Value

The width in pixels.

Examples

file <- stats_card(example_stats(), tempfile(fileext = ".png"))
rghcard:::png_width(file)   # twice the width of the card
#> [1] 1800