Learn R Programming

RootscanR (version 0.0.1)

cm2px: Functions for converting pixels and centimeters

Description

cm2px - Converts centimeters to pixels.

px2cm - Converts pixels to centimeters.

Usage

cm2px(cm, ppcm = NULL, ppi = NULL)

px2cm(px, ppcm = NULL, ppi = NULL)

Value

cm2px Numeric value or numeric vector (pixels).

px2cm Numeric value or numeric vector (centimeters).

Arguments

cm

Numeric value or numeric vector (centimeters) to be converted to pixels.

ppcm

Numeric value or numeric vector (default NULL) of the same length as cm or px specifying how many pixels there are per centimeter. If ppcm is not NULL, ppi is ignored.
Examples: 300 ppi (printing) is 118 ppcm, 150 ppi is 59 ppcm, 72 ppi (screens) is 28 ppcm.

ppi

Numeric value or numeric vector (default NULL) of the same length as cm or px specifying how many pixels there are per inch. Set ppcm to NULL to use ppi.
Examples: 300 ppi (printing) is 118 ppcm, 150 ppi is 59 ppcm, 72 ppi (screens) is 28 ppcm.

px

Numeric value or numeric vector (pixels) to be converted to centimeters.

Examples

Run this code
cm2px(2, 4)
px2cm(2, 4)

Run the code above in your browser using DataLab