gridgraphics
gridgraphics copied to clipboard
Use 'magick' package when installed
Currently one check failing because convert
is not installed. Maybe try magick::image_convert
which is available on most platforms. See here for an example.
Thanks for the suggestion. If I am reading the 'magick' source correctly, this would still fail to build where ImageMagick is unavailable (i.e., 'magick' does not bundle ImageMagick), but would do so (far) more elegantly. Is that correct?
Not entirely. The magick
package links to the libimagemagick
C++ library, and can only be installed if the libimagemagick
is available. This means that if the magick
package is installed, it is guaranteed to work. You don't need to check for command line utilities at runtime.
Moreover, on windows and mac the CRAN binary packages ship with a statically linked libmagick++
. The user doesn't need to install anything extra. Hence the R magick
package will always work out of the box on Windows and OSX.
Ah! Even better than I thought. I will look at using this - I also make use of ImageMagick's 'compare', but I see that there is also an interface for that in 'magick'. Thanks again!
Ok, small problem. When I convert, I want to specify -density, plus possibly +antialias. I can't see a way to do that with 'magick'
What exactly are you converting to what? There is a density
parameter in image_read()
to specify a density when rendering the input format into a bitmap object. I'll have to consult the documentation for antialiasing options...
If you're converting pdf
to a bitmap type, also have a look at our pdftools::pdf_convert()
which has very high quality bitmap rendering, and lets you specify a dpi as well (enables antialias by default)
In some situations I need to do something like 'convert -density 100x100 +antialias test.pdf test.png' (but I also need to be able to adjust the density and to remove the +antialias)
Next problem :) When I do the image_compare() I want the visual diff file that 'compare' produces ...
I guess I could use image_composite() with appropriate operators to get the visual diff myself, but is there an easier way ?