geometry: Geometry Helpers

Description Usage Arguments Details See Also Examples

Description

ImageMagick uses a handy geometry syntax to specify coordinates and shapes for use in image transformations. You can either specify these manually as strings or use the helper functions below.

Usage

1
2
3
4
5
6
7
8
geometry_point(x, y)

geometry_area(width = NULL, height = NULL, x_off = 0, y_off = 0)

geometry_size_pixels(width = NULL, height = NULL,
  preserve_aspect = TRUE)

geometry_size_percent(width = 100, height = NULL)

Arguments

x

left offset in pixels

y

top offset in pixels

width

in pixels

height

in pixels

x_off

offset in pixels on x axis

y_off

offset in pixels on y axis

preserve_aspect

if FALSE, resize to width and height exactly, loosing original aspect ratio. Only one of percent and preserve_aspect may be TRUE.

Details

See ImageMagick Manual for details about the syntax specification. Examples of geometry strings:

See Also

Other image: _index_, analysis, animation, attributes, color, composite, device, edges, editing, effects, fx, morphology, ocr, options, painting, segmentation, transform, video

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Specify a point
 <- image_read("logo:")
image_annotate(, "Some text", location = geometry_point(100, 200), size = 24)

# Specify image area
image_crop(, geometry_area(300, 300), repage = FALSE)
image_crop(, geometry_area(300, 300, 100, 100), repage = FALSE)

# Specify image size
image_resize(, geometry_size_pixels(300))
image_resize(, geometry_size_pixels(height = 300))
image_resize(, geometry_size_pixels(300, 300, preserve_aspect = FALSE))

# resize relative to current size
image_resize(, geometry_size_percent(50))
image_resize(, geometry_size_percent(50, 20))

ropensci/magick documentation built on Jan. 15, 2019, 3:27 a.m.