Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 'magick' package when installed #5

Open
jeroen opened this issue Jun 11, 2017 · 8 comments
Open

Use 'magick' package when installed #5

jeroen opened this issue Jun 11, 2017 · 8 comments

Comments

@jeroen
Copy link

jeroen commented Jun 11, 2017

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.

@pmur002
Copy link
Owner

pmur002 commented Jun 13, 2017

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?

@jeroen
Copy link
Author

jeroen commented Jun 13, 2017

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.

@pmur002
Copy link
Owner

pmur002 commented Jun 13, 2017

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!

@pmur002
Copy link
Owner

pmur002 commented Jun 13, 2017

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'

@jeroen
Copy link
Author

jeroen commented Jun 13, 2017

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)

@pmur002
Copy link
Owner

pmur002 commented Jun 13, 2017

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)

@pmur002
Copy link
Owner

pmur002 commented Jun 14, 2017

Next problem :) When I do the image_compare() I want the visual diff file that 'compare' produces ...

@pmur002
Copy link
Owner

pmur002 commented Jun 14, 2017

I guess I could use image_composite() with appropriate operators to get the visual diff myself, but is there an easier way ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants