Learn R Programming

R2SWF (version 0.1-0)

get_image_size: Get the size of an image

Description

This function returns the width and height of an image. Supported formats are jpg/jpeg, png, gif and svg.

Usage

get_image_size(filename)

Arguments

filename
the path of the image file.

Value

  • A list containing the width and height of the image.

Details

This function is mainly used internally to decide the width and height of the SWF file according to the sizes of input images.

For jpg/jpeg, png and gif formats, the function returns the image size in pixels. For svg file, width is always set to 640 px and height is adjusted according to the width/height ratio. If the image size could not be determined, then default values (640x640, in pixels) are used.

Examples

Run this code
get_image_size(normalizePath(file.path(R.home("doc"), 
    "html/logo.jpg")))

Run the code above in your browser using DataLab