楼主: Lisrelchen
1611 13

[R Package]magick [推广有奖]

  • 0关注
  • 62粉丝

VIP

已卖:4194份资源

院士

67%

还不是VIP/贵宾

-

TA的文库  其他...

Bayesian NewOccidental

Spatial Data Analysis

东西方数据挖掘

威望
0
论坛币
50288 个
通用积分
83.6906
学术水平
253 点
热心指数
300 点
信用等级
208 点
经验
41518 点
帖子
3256
精华
14
在线时间
766 小时
注册时间
2006-5-4
最后登录
2022-11-6

楼主
Lisrelchen 发表于 2017-8-22 02:48:23 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
magick: Advanced Graphics and Image-Processing in R

Bindings to 'ImageMagick': the most comprehensive open-source image processing library available. Supports many common formats (png, jpeg, tiff, pdf, etc) and manipulations (rotate, scale, crop, trim, flip, blur, etc). All operations are vectorized via the Magick++ STL meaning they operate either on a single frame or a series of frames for working with layers, collages, or animation. In RStudio images are automatically previewed when printed to the console, resulting in an interactive editing environment. The latest version of the package includes a native graphics device for creating in-memory graphics or drawing onto images using pixel coordinates.

Version:1.2
Imports:Rcpp (≥ 0.12.12), curl
LinkingTo:Rcpp
Suggests:knitr, rmarkdown, magrittr, rsvg, webp, png, pdftools, ggplot2, raster, rgdal, gapminder, tesseract
Published:2017-08-21
Author:Jeroen Ooms
Maintainer:Jeroen Ooms <jeroen at berkeley.edu>
BugReports:https://github.com/ropensci/magick/issues
License:MIT + file LICENSE
URL:https://github.com/ropensci/magick#readme
NeedsCompilation:yes
SystemRequirements:ImageMagick++: ImageMagick-c++-devel (rpm) or libmagick++-dev (deb)
Materials:NEWS
CRAN checks:magick results
Downloads:
Reference manual:magick.pdf
Vignettes:The magick package: Advanced Image-Processing in R
Package source:magick_1.2.tar.gz
Windows binaries:r-devel: magick_1.1.zip, r-release: magick_1.1.zip, r-oldrel: magick_1.1.zip
OS X El Capitan binaries:r-release: magick_1.0.tgz
OS X Mavericks binaries:r-oldrel: magick_1.1.tgz
Old sources:magick archive
Reverse dependencies:
Reverse imports:texPreview
Reverse suggests:dlib, hypervolume, mem, memapp, replyr, rgl, tesseract
Linking:

Please use the canonical form https://CRAN.R-project.org/package=magick to link to this page.


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:package Magic Pack Age PAC

沙发
Lisrelchen 发表于 2017-8-22 02:49:25
  1. Examples
  2. logo <- image_read("logo:")
  3. logo2 <- image_blur(logo, 3)
  4. logo3 <- image_oilpaint(logo, 3)
  5. if(magick_config()$version >= "6.8.7"){
  6. image_compare(logo, logo2, metric = "phash")
  7. image_compare(logo, logo3, metric = "phash")
  8. }
复制代码

藤椅
Lisrelchen 发表于 2017-8-22 02:50:36
  1. Examples
  2. # Combine images
  3. logo <- image_read("https://www.r-project.org/logo/Rlogo.png")
  4. oldlogo <- image_read("https://developer.r-project.org/Logo/Rlogo-3.png")
  5. # Create morphing animation
  6. both <- image_scale(c(oldlogo, logo), "400")
  7. image_average(image_crop(both))
  8. image_animate(image_morph(both, 10))
  9. # Create thumbnails from GIF
  10. banana <- image_read("https://jeroen.github.io/images/banana.gif")
  11. length(banana)
  12. image_average(banana)
  13. image_flatten(banana)
  14. image_append(banana)
  15. image_append(banana, stack = TRUE)
复制代码

板凳
Lisrelchen 发表于 2017-8-22 02:52:13
  1. Examples
  2. # manually adjust colors
  3. logo <- image_read("logo:")
  4. image_modulate(logo, brightness = 200)
  5. image_modulate(logo, saturation = 150)
  6. image_modulate(logo, hue = 200)
  7. # Reduce image to 10 different colors using various spaces
  8. image_quantize(logo, max = 10, colorspace = 'gray')
  9. image_quantize(logo, max = 10, colorspace = 'rgb')
  10. image_quantize(logo, max = 10, colorspace = 'cmyk')
  11. # Change background color
  12. translogo <- image_transparent(logo, 'white')
  13. image_background(translogo, "pink", flatten = TRUE)
  14. # Compare to flood-fill method:
  15. image_fill(logo, "pink", fuzz = 10000)
  16. # Other color tweaks
  17. image_colorize(logo, 50, "red")
  18. image_contrast(logo)
  19. image_normalize(logo)
  20. image_enhance(logo)
  21. image_equalize(logo)
  22. image_median(logo)
  23. # Alternate way to convert into black-white
  24. image_convert(logo, type = 'grayscale')
复制代码

报纸
Lisrelchen 发表于 2017-8-22 02:53:11
  1. Examples
  2. # Compose images using one of many operators
  3. imlogo <- image_scale(image_read("logo:"), "x275")
  4. rlogo <- image_read("https://developer.r-project.org/Logo/Rlogo-3.png")
  5. # Standard is atop
  6. image_composite(imlogo, rlogo)
  7. # Same as 'blend 50' in the command line
  8. image_composite(imlogo, rlogo, operator = "blend", compose_args="50")
  9. # Add a border frame around the image
  10. image_border(imlogo, "red", "10x10")
  11. image_frame(imlogo)
复制代码

地板
Lisrelchen 发表于 2017-8-22 02:54:48
  1. Examples
  2. # Regular image
  3. frink <- image_read("https://jeroen.github.io/images/frink.png")
  4. # Produce image using graphics device
  5. fig <- image_graph(res = 96)
  6. ggplot2::qplot(mpg, wt, data = mtcars, colour = cyl)
  7. dev.off()
  8. # Combine
  9. out <- image_composite(fig, frink, offset = "+70+30")
  10. print(out)
  11. # Or paint over an existing image
  12. img <- image_draw(frink)
  13. rect(20, 20, 200, 100, border = "red", lty = "dashed", lwd = 5)
  14. abline(h = 300, col = 'blue', lwd = '10', lty = "dotted")
  15. text(10, 250, "Hoiven-Glaven", family = "courier", cex = 4, srt = 90)
  16. palette(rainbow(11, end = 0.9))
  17. symbols(rep(200, 11), seq(0, 400, 40), circles = runif(11, 5, 35),
  18. bg = 1:11, inches = FALSE, add = TRUE)
  19. dev.off()
  20. print(img)
  21. # Vectorized example with custom coordinates
  22. earth <- image_read("https://jeroen.github.io/images/earth.gif")
  23. img <- image_draw(earth, xlim = c(0,1), ylim = c(0,1))
  24. rect(.1, .1, .9, .9, border = "red", lty = "dashed", lwd = 5)
  25. text(.5, .9, "Our planet", cex = 3, col = "white")
  26. dev.off()
  27. print(img)
复制代码

7
Lisrelchen 发表于 2017-8-22 02:55:48
  1. Examples
  2. # Download image from the web
  3. frink <- image_read("https://jeroen.github.io/images/frink.png")
  4. worldcup_frink <- image_fill(frink, "orange", "+100+200", 30000)
  5. image_write(worldcup_frink, "output.png")
  6. # extract raw bitmap array
  7. bitmap <- frink[[1]]
  8. # replace pixels with #FF69B4 ('hot pink') and convert back to image
  9. bitmap[,50:100, 50:100] <- as.raw(c(0xff, 0x69, 0xb4, 0xff))
  10. image_read(bitmap)
  11. # Plot to graphics device via legacy raster format
  12. raster <- as.raster(frink)
  13. par(ask=FALSE)
  14. plot(raster)
  15. # Read bitmap arrays
  16. curl::curl_download("https://www.r-project.org/logo/Rlogo.png", "Rlogo.png")
  17. image_read(png::readPNG("Rlogo.png"))
  18. curl::curl_download("https://jeroen.github.io/images/example.webp", "example.webp")
  19. image_read(webp::read_webp("example.webp"))
  20. curl::curl_download("http://jeroen.github.io/images/tiger.svg", "tiger.svg")
  21. image_read(rsvg::rsvg("tiger.svg"))
复制代码

8
Lisrelchen 发表于 2017-8-22 02:56:40
  1. Examples
  2. logo <- image_read("logo:")
  3. image_despeckle(logo)
  4. image_reducenoise(logo)
  5. image_noise(logo)
  6. image_blur(logo, 10, 10)
  7. image_charcoal(logo)
  8. image_edge(logo)
  9. image_oilpaint(logo, radius = 3)
  10. image_emboss(logo)
  11. image_implode(logo)
  12. image_negate(logo)
复制代码

9
Lisrelchen 发表于 2017-8-22 02:57:23
  1. Examples
  2. if(require("tesseract")){
  3. img <- image_read("http://jeroen.github.io/images/testocr.png")
  4. image_ocr(img)
  5. }
复制代码

10
Lisrelchen 发表于 2017-8-22 02:58:49
  1. Examples
  2. logo <- image_read("logo:")
  3. logo <- image_transparent(logo, 'white')
  4. image_fill(image_flatten(logo), "red")
  5. image_fill(image_flatten(logo), "red", fuzz = 25600)
  6. # Add some text to an image
  7. image_annotate(logo, "This is a test")
  8. image_annotate(logo, "CONFIDENTIAL", size = 50, color = "red", boxcolor = "pink",
  9. degrees = 30, location = "+100+100")
  10. # Setting fonts requires fontconfig support (and that you have the font)
  11. myfont <- ifelse(identical("windows", .Platform$OS.type), "courier-new", "courier")
  12. try(image_annotate(logo, "The quick brown fox", font = myfont, size = 50))
复制代码

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-23 04:27