image_info: Empty canvas from existing image or specified dimensions

image_canvasR Documentation

Empty canvas from existing image or specified dimensions

Description

Extends 'magick::image_blank()' to allow creating blank image with or without manually specifying width and height. If specimen image is provided dimensions will be copied from it.

Calculate space taken by every latter in annotation

Usage

image_canvas(
  image = NULL,
  color = "transparent",
  width = NULL,
  height = NULL,
  units = "px",
  dpi = 96,
  pseudo_image = ""
)

image_annotate_info(
  text,
  size = 10,
  font = "",
  style = "normal",
  weight = 400,
  ...
)

Arguments

image

existing image to copy dimensions from (content will be discarded)

color

color of the blank image. Default: 'transparent'

width

canvas width

height

canvas width

units

one of "in", "cm" or "px". Default="px".

dpi

specification of density (required for any 'units' other than "px"). Default = 96

pseudo_image

name of the pseudo-image. Default: ""

text

proposed text for annotation

size

text size. Default: 10

font

text font to be passed to 'image_annotate()'. Default: ”

style

font style to be passed to ‘image_annotate()' (e.g. "normal", "italic", "oblique"). Default: ’normal'

weight

font weight. Normal is 400, bold is 700. Default: 400

...

currently ignored

Details

The purpose of this function is to calculate kerning between letters that fonts introduce on the fly. This can be helpful in designing custom kerning.

Value

blank image of given dimensions

data frame with measurements for every letter and the phrase in total

Examples

## Not run: 
if(interactive()){
 frink <- image_read("https://jeroen.github.io/images/frink.png")
 image_canvas(frink, "pink")

 # will produce 504x360 canvas
 image_canvas(width=7, height=5, units="in", dpi=72, color="burlywood")
 # will produce 800x600 canvas
 image_canvas(width=800, height=600, color="cornsilk")

 # will produce 377x566 canvas
 image_canvas(width=10, height=15, units="cm", dpi=96, color="aliceblue")
 }

## End(Not run)
## Not run: 
if(interactive()){
 #EXAMPLE1
 }

## End(Not run)

dmi3kno/bunny documentation built on Dec. 7, 2022, 7:22 p.m.