Get the width and height in pixels of an image file or of a raster object.
The dimensions of 'png', 'jpeg' and 'gif' files are read from their header, without decoding the image, which is much faster. Other formats are read with package 'magick', which must then be installed.
Arguments
- x
path to an image file, or a raster object (see
grDevices::as.raster()).
