user2550487
user2550487

Reputation: 61

ImageMagick in R

I want to use ImageMagick in R, but R won't let me install it.

install.packages("ImageMagick")
Installing package into ‘C:/Users/FSFH-2/Documents/R/win-library/3.0’
(as ‘lib’ is unspecified)
Warning message:
package ‘ImageMagick’ is not available (for R version 3.0.1) 

I'm under the impression that I have the latest version of R, so what's going on here?

Additionally, I downloaded ImageMagick into windows, but I can't figure out how to get it into R. Help!

Upvotes: 6

Views: 27960

Answers (7)

nghiaht
nghiaht

Reputation: 795

Just follow the link Link to download and install ImageMagick on Windows. After that, type your command (like convert ...) in cmd.exe to verify that ImageMagick does exist. At this time, I know that we can only use it in cmd.exe, not in R.

Upvotes: 2

Jimmy
Jimmy

Reputation: 2280

you need to install a package named "installr" prior to installing ImageMagick.

Simple Steps:

  1. Tools->InstallPackages->installr
  2. From R command Line write
    • require(installr)
    • install.ImageMagick() (This command will by default install the latest version, u can specify the URl of the version needed)

The package will be installed !!!

Upvotes: 14

Paras Sidiqui
Paras Sidiqui

Reputation: 1

If you are on Mac, what just worked for me was to use port in Terminal.

I installed ImageMagick, and then I had to install animation in R itself.

In terminal:

sudo port install ImageMagick

... it installs a few package dependencies and finishes up.

In the R studio afterwards:

install.packages("animation")

and then check by running following example:

saveGIF({
    for (i in 1:10) plot(runif(10), ylim = 0:1)
})

if the above conversion was successful, the option 'convert' should not be NULL

Upvotes: 0

Ben
Ben

Reputation: 42283

There is now a package magick that wraps around the ImageMagick STL.

It can be installed simply with install.packages("magick")

There is a blog post explaining what you can do with it here: https://ropensci.org/blog/2016/08/23/z-magick-release

Upvotes: 13

Zhuang-Fang Yi
Zhuang-Fang Yi

Reputation: 19

I used these commands in RStudio.

  • install.packages('installr')
  • library(installr)
  • install.ImageMagick()

It installed the latest version of ImageMagick.

Upvotes: 1

n1k31t4
n1k31t4

Reputation: 2874

If you are on Mac, what just worked for me was to use Homebrew in Terminal (if you don't have homebrew or anything similar, get it!).

I installed ImageMagick, and then I had to install animation in R itself.

In terminal:

sudo brew install ImageMagick

... it installs a few package dependencies and finishes up.

In the R console afterwards (in R, Rstudio, Emacs, ...):

install.packages("animation")

Now try ?gganimate and run the examples at the bottom to test it out!

The examples in the help file worked without problem for me. This works within Rstudio very fluidly, Rstudio being written just as a web-browser is under the hood. I personally use ESS within Emacs, which for plotting usually opens an X11 (or Quartz) window. Using gg_animate, however, opens a browser by default and displays the output there.

Upvotes: 2

PAC
PAC

Reputation: 5366

If you're using Mac OS or Linux, you can install ImageMagick on your system and then use it from within R using the system() function. I don't know if ImageMagick works with Windows.

Upvotes: 0

Related Questions