crop | R Documentation |
Remove or add margins to images and templates.
crop( stimuli, width = 1, height = 1, x_off = NULL, y_off = NULL, fill = wm_opts("fill") )
stimuli |
list of stimuli |
width, height |
dimensions of cropped image in pixels or proportion (<2) |
x_off, y_off |
offset in pixels or proportion (<1) (NULL centers cropped image) |
fill |
background color if cropping goes outside the original image, see |
Dimensions and offsets can be set in pixels or proportions. For width and height, values less than 2 will be interpreted as proportions, otherwise pixels. For x_off and y_off, values between -1 and 1 are interpreted as proportions, otherwise pixels.
Cropping is anchored at the image center (or calculated template centroid if there is no image) unless x_off or y_off are set.
list of stimuli with cropped tems and/or images
Stimulus manipulation functions
align()
,
crop_tem()
,
greyscale()
,
horiz_eyes()
,
image_func()
,
mask_oval()
,
mask()
,
mirror()
,
pad()
,
resize()
,
rotate()
,
to_size()
stimuli <- demo_stim() # crop to 60% width and 80% height (centered) crop(stimuli, width = .60, height = .80) # crop to upper right quadrant crop(stimuli, .5, .5, x_off = .5, y_off = 0) # negative offset with fill crop(stimuli, 260, 260, x_off = -10, y_off = -10, fill = c("red", "dodgerblue"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.