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

"image" pattern bug with type = "tile" #47

Closed
trevorld opened this issue Nov 29, 2021 · 4 comments
Closed

"image" pattern bug with type = "tile" #47

trevorld opened this issue Nov 29, 2021 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@trevorld
Copy link
Owner

  • Sometimes the "image" pattern doesn't work on certain platforms and R provides a "magick_image_readpath()" error.
  • I've noticed before that the "tile" pattern_type seems to reliably choke on CRAN/Rhub Windows and OSX machines but seems to work fine on Linux and Solaris machines. I suspect this is some subtle upstream magick bug that only affects certain platforms (and/or only certain magick versions?). It isn't something I've been able to reproduce locally on my Linux laptop (where it works fine) but I have been able to reproduce indirectly via R-builder/Rhub checks on relevant platforms.
  • This bug has also been noticed downstream: "image" pattern bug with 'type = "tile"' ggpattern#37
@trevorld trevorld added bug Something isn't working help wanted Extra attention is needed labels Nov 29, 2021
@trevorld
Copy link
Owner Author

Reproduced in RStudio on a Windows machine:

logo_filename   <- system.file("img", "Rlogo.png" , package="png")
gridpattern::grid.pattern_image(filename = logo_filename, type = "tile")
Invalid Parameter - 247x247
Error in magick_image_readpath(path, density, depth, strip, defines) : 
  rsession.exe: UnableToOpenBlob `C:\Users\Frank\AppData\Local\Temp\RtmpMj8nXg\file2bac745d50c2.png': No such file or directory @ error/blob.c/OpenBlob/2924

@trevorld
Copy link
Owner Author

Issue is we call convert via system() but on Windows convert is usually something other than imagemagick so it is choking.

It should theoretically be possible to tile images using magick::image_blank() but for some reason it is inconsistently buggy:

library("grid")
library("magick")
library("png")
logo_filename   <- system.file("img", "Rlogo.png" , package="png")
pseudo = paste0("tile:", logo_filename)
grid.raster(magick::image_blank(600, 600, pseudo_image = pseudo))

@trevorld trevorld changed the title 'magick_image_readpath()' error "image" pattern bug with type = "tile" Feb 15, 2022
@trevorld
Copy link
Owner Author

image_blank() inconsistency reported upstream: ropensci/magick#344

@trevorld trevorld reopened this Feb 15, 2022
@trevorld trevorld removed the help wanted Extra attention is needed label Feb 15, 2022
@trevorld
Copy link
Owner Author

{magick} maintainer suggests manually tiling image using image_append() or image_montage() (would need to do some manual calculations and then crop/chop at the end).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant