painting {magick} | R Documentation |
Image Painting
Description
The image_fill()
function performs flood-fill by painting starting point and all
neighboring pixels of approximately the same color. Annotate prints some text on
the image.
Usage
image_fill(image, color, point = "+1+1", fuzz = 0, refcolor = NULL)
image_annotate(
image,
text,
gravity = "northwest",
location = "+0+0",
degrees = 0,
size = 10,
font = "",
style = "normal",
weight = 400,
kerning = 0,
decoration = NULL,
color = NULL,
strokecolor = NULL,
strokewidth = NULL,
boxcolor = NULL
)
Arguments
image |
magick image object returned by |
color |
a valid color string such as
|
point |
a geometry_point string indicating the starting point of the flood-fill |
fuzz |
relative color distance (value between 0 and 100) to be considered similar in the filling algorithm |
refcolor |
if set, |
text |
character vector of length equal to 'image' or length 1 |
gravity |
string with gravity value from gravity_types. |
location |
geometry string with location relative to |
degrees |
rotates text around center point |
size |
font-size in pixels |
font |
string with font family such as |
style |
value of style_types for example |
weight |
thickness of the font, 400 is normal and 700 is bold, see |
kerning |
increases or decreases whitespace between letters |
decoration |
value of decoration_types for example |
strokecolor |
a color string adds a stroke (border around the text) |
strokewidth |
set the strokewidth of the border around the text |
boxcolor |
a color string for background color that annotation text is rendered on. |
Details
Note that more sophisticated drawing mechanisms are available via the graphics device using image_draw.
Setting a font, weight, style only works if your imagemagick is compiled with fontconfig support.
See Also
Other image:
_index_
,
analysis
,
animation
,
attributes()
,
color
,
composite
,
defines
,
device
,
edges
,
editing
,
effects()
,
fx
,
geometry
,
morphology
,
ocr
,
options()
,
segmentation
,
transform()
,
video
Examples
logo <- image_read("logo:")
logo <- image_background(logo, 'white')
image_fill(logo, "pink", point = "+450+400")
image_fill(logo, "pink", point = "+450+400", fuzz = 25)
# Add some text to an image
image_annotate(logo, "This is a test")
image_annotate(logo, "CONFIDENTIAL", size = 50, color = "red", boxcolor = "pink",
degrees = 30, location = "+100+100")
# Setting fonts requires fontconfig support (and that you have the font)
image_annotate(logo, "The quick brown fox", font = "monospace", size = 50)