Description Usage Arguments Examples
Remove image background
1 2 3 4 5 6 7 8 |
image_path |
filename w/o the full path |
bkg_thr |
background threshold, any pixel below this value will be set to zero (black) and one (white) in the alpha layer, to create a transparency effect. |
plot |
boolean flag on whether or not to generate a histogram of the
pixel values. This can be used to determine an optimal |
trim_areas |
data frame containing areas to be trimmed (add
transparency). Each row must have the same format of To invert the area (trim right to left or bottom to top), set
To modify from |
quiet |
boolean flag to hide messages |
... |
extra parameters for |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
test_data <- data.frame(name = c("R", "G"), values = c(2, 2))
RG <- c("red", "green")
png("test_plot.png")
par(bg = 'black')
barplot(height = test_data$values, names = test_data$name, col = RG)
dev.off()
rm_background("test_plot.png", 0.1)
rm_background("test_plot.png", 0.1, TRUE)
rm_background("test_plot.png", 0.1, TRUE, breaks = 10)
trim_areas <- data.frame(x0 = 1, width = -1, y0 = 1, height = 100)
trim_areas <- rbind(trim_areas, c(1, -1, -1, 100))
rm_background("test_plot.png", 0.1, TRUE, trim_areas, breaks = 10)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.