Failure to Execute convert with tmap in R

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dtumminelliob
Posts: 3
Joined: 2019-08-02T16:26:44-07:00
Authentication code: 1152

Failure to Execute convert with tmap in R

Post by dtumminelliob »

I am trying to run the tmap animate function in R and it is failing to engage Image Magick effectively. I have succeeded in getting the system to recognize the Image Magick path and when I enter convert -version into the Command Prompt it works. tmap, however, can't seem to generate the .gif. Here is my code:

Code: Select all

test<-tm_shape(tracts_geo) + tm_polygons(c("LOCALINV_PP.2018","LOCALINV_PP.2010")) + tm_facets(nrow=1,ncol=1)
tmap_animation(test, filename="C:/Downloads/test.gif",width=1200)
And here is the error:
Warning message:
In

Code: Select all

syscall(paste(program, " -loop ", loop, " -delay ", delay, " ",  :
  'convert -loop 0 -delay 40 C:\Users\BARIUS~1\AppData\Local\Temp\RtmpozsJDP//tmap_plots/*.png "C:/Downloads/test.gif"' execution failed with error code 1
I realize this is a problem at the interface of two different programs but I figured I'd try here first.

Thanks for the help,
Dan
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Failure to Execute convert with tmap in R

Post by fmw42 »

Please show what you get returned from

Code: Select all

convert -version
Lets be sure you he all the needed delegates and the version installed. What is your platform/OS?


Does this work from the command line?

Code: Select all

convert logo: logo.gif
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Failure to Execute convert with tmap in R

Post by snibgo »

What version of IM? On what platform? I assume Windows of some sort.

I know nothing about tmap or R.

Your paths have mixed forward-slash and reverse-slash, and a double-slash. These may work, but are unwise. If your PNG files are too large, this might cause a failure. Does the command work at the command line?

EDIT to add:

Are you running IM's convert, or Microsoft convert?

As Fred suggests, start simple, eg:

Code: Select all

convert rose: NULL
If that doesn't work, then the problem isn't with the filenames.
snibgo's IM pages: im.snibgo.com
dtumminelliob
Posts: 3
Joined: 2019-08-02T16:26:44-07:00
Authentication code: 1152

Re: Failure to Execute convert with tmap in R

Post by dtumminelliob »

Thanks, all. When I run convert -version, I get:
Version: ImageMagick 7.0.8-58 Q16 x64 2019-07-30 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenCL OpenMP(2.0)
Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg lcms lqr lzma openexr pangocairo png ps raw rsvg tiff webp xml zlib

I realize that convert is based on IM 6, but I did install with the earlier versions check box ticked off.

convert logo: logo.gif

generates nothing--no warning, but also no product.

I also entered convert rose: NULL, which did nothing. Entering just convert rose generates an extended list of image setting options.

I am operating in Windows 10. The slash situation I agree is highly confusing but is a side-effect of R. My assumption (hope) is that tmap has been constructed properly to deal with those translations from R to the standard assumptions of the OS environment, being that others have successfully leveraged Image Magick through tmap. If that's the case, then the issue is probably still with how Image Magick is configured on my machine.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Failure to Execute convert with tmap in R

Post by snibgo »

dtumminelliob wrote:convert logo: logo.gif

generates nothing--no warning, but also no product.
Did you issue that command at the Windows Console aka Command Line? If so, then don't worry about R and tmap for now, because ImageMagick isn't working properly.

My mistake, I should have put a colon after NULL:

Code: Select all

convert rose: NULL:
That IM command shouldn't do anything. If you were running the Microsoft command by mistake, you would get:

Code: Select all

Invalid Parameter - NULL:
Your "convert -version" looks good. I don't know what the problem is.

Where did you install from? What web page? How did you install?
snibgo's IM pages: im.snibgo.com
dtumminelliob
Posts: 3
Joined: 2019-08-02T16:26:44-07:00
Authentication code: 1152

Re: Failure to Execute convert with tmap in R

Post by dtumminelliob »

Yes, I ran that through the Command Prompt screen. convert logo: logo.gif still generates a blank. convert rose: NULL: also generates a blank. No error, but nothing else either.

I downloaded from the main ImageMagick site the version for Windows 64-bit: ImageMagick-7.0.8-58-Q16-x64-dll.exe. I then installed through the standard UI with options to put it in the system path and old versions. However, I had to enter the system path myself manually. The tests prompted by the installation worked, though, generating the image of the wizard.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Failure to Execute convert with tmap in R

Post by fmw42 »

Windows has its own convert? Are you using ImageMagick or Windows convert? Perhaps rename imageamgick convert to im_convert.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Failure to Execute convert with tmap in R

Post by snibgo »

dtumminelliob wrote:I downloaded from the main ImageMagick site the version for Windows 64-bit: ImageMagick-7.0.8-58-Q16-x64-dll.exe. I then installed through the standard UI with options to put it in the system path and old versions.
That seems fine. And we have established that you are not accidentally running Microsoft convert.

But something is badly wrong. I suggest you download again, and install again.
snibgo's IM pages: im.snibgo.com
Post Reply