The function allows you to modify a subregion of your image (or, the opposite, keep the subregion unchanged while modifying other parts). You can set the four sides of the subregion or an irregular polygon by mouse click. If it is irregular, you MUST click in order.
image_modify_local(
x,
FUN,
geometry = "click",
local = "local",
rectangle = TRUE,
trim = FALSE,
...
)
an image read into R by
magick::image_read
or an image
modified by functions in the magick
package.
the function used to
modify x
. NOTE: the result
of FUN
must be of the same
class as x
and its width and
height must not be changed during
modification.
this parameter is
different from the one used in package
magick. Here, in this function, you can
set geometry = "click"
if you want
to show which part you want to modify
by mouse click (see
function image_crop_click
for how to
use mouse click). Otherwise, you can use
a length 4 vector with the exact order: left,
right, top, bottom.
if it is 1 or "local", only a subregion of your image will be modified. If it is 2 or "other", keep the subregion unchanged while modifying other parts. If it is 3 or "subregion", the result is only the modified subregion, not the whole image.
if it is TRUE (default), the subregion is a rectangle. If it is FALSE, the subregion can be an irregular polygon designated by your mouse click.
whether to trim the subregion.
This is only used when local
is 3 or "subregion". It helps remove
the transparent parts. See image_crop_click
to know how to use this parameter.
extra parameters used by
FUN
.