color: a valid color string such as "navyblue" or "#000080". Use "none" for transparency.
threshold: straightens an image. A threshold of 40 works for most images.
pagesize: geometry string with preferred size and location of an image canvas
density: geometry string with vertical and horizontal resolution in pixels of the image. Specifies an image density when decoding a Postscript or PDF.
orientation: string to set image orientation one of the orientation_types . If NULL it applies auto-orientation which tries to infer the correct orientation from the Exif data.
distortion: string to set image orientation one of the distort_types .
coordinates: numeric vector (typically of length 12) with distortion coordinates
bestfit: if set to TRUE the size of the output image can be different from input
image_scale and image_sample resize using simple ratio and pixel sampling algorithm.
image_flip and image_flop invert image vertically and horizontally
The most powerful resize function is image_resize which allows for setting a custom resize filter. Output of image_scale is similar to image_resize(img, filter = "point").
For resize operations it holds that if no geometry is specified, all frames are rescaled to match the top frame.
Examples
logo <- image_read("logo:")logo <- image_scale(logo,"400")image_trim(logo)image_chop(logo,"100x20")image_rotate(logo,45)# Small imagerose <- image_convert(image_read("rose:"),"png")# Resize to 400 width or height:image_resize(rose,"400x")image_resize(rose,"x400")# Resize keeping ratioimage_resize(rose,"400x400")# Resize, force size losing ratioimage_resize(rose,"400x400!")# Different filtersimage_resize(rose,"400x", filter ="Triangle")image_resize(rose,"400x", filter ="Point")# simple pixel resizeimage_scale(rose,"400x")image_sample(rose,"400x")image_crop(logo,"400x400+200+200")image_extent(rose,'200x200', color ='pink')image_flip(logo)image_flop(logo)skewed <- image_rotate(logo,5)deskewed <- image_deskew(skewed)attr(deskewed,'angle')if(magick_config()$version >"6.8.6") image_orient(logo)image_shear(logo,"10x10")building <- demo_image('building.jpg')image_distort(building,'perspective', c(7,40,4,30,4,124,4,123,85,122,100,123,85,2,100,30))