x3p_crop {x3ptools}R Documentation

Crop an x3p object to a specified width and height

Description

Cuts out a rectangle of size width x height from the location (x, y) of an x3p object. x and y specify the bottom right corner of the rectangle. In case the dimensions of the surface matrix do not allow for the full dimensions of the rectangle cutout the dimensions are adjusted accordingly.

Usage

x3p_crop(x3p, x = 1, y = 1, width = 128, height = 128)

Arguments

x3p

x3p object

x

integer, location (in pixels) of the leftmost side of the rectangle,

y

integer, location (in pixels) of the leftmost side of the rectangle,

width

integer, width (in pixels) of the rectangle,

height

integer, height (in pixels) of the rectangle,

Examples

logo <- x3p_read(system.file("csafe-logo.x3p", package="x3ptools"))
# crop the x3p file to just the CSAFE logo
logo_only <- x3p_crop(logo, x=20, y=50, width = 255 ,height =310)
logo_only <- x3p_crop(logo, x=20, y=50, width = 255 ,height =510)
# x3p_image(logo_only, size=c(500,500), zoom = 1)

[Package x3ptools version 0.0.4 Index]