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

Frame Idea #2 #6

Open
benyamindsmith opened this issue Dec 26, 2022 · 4 comments
Open

Frame Idea #2 #6

benyamindsmith opened this issue Dec 26, 2022 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@benyamindsmith
Copy link
Owner

Need to figure out the Shiny Code/CSS to do this:

image

@benyamindsmith benyamindsmith added enhancement New feature or request help wanted Extra attention is needed labels Dec 26, 2022
@GTBoon72
Copy link

Maybe magick comes in handy here, the R wrapper for ImageMagick.

@benyamindsmith
Copy link
Owner Author

@GTBoon72 interesting. It may be possible to create these frames by making transparent places where the maps are supposed to be and overlaying it on the leaflet maps.

@GTBoon72
Copy link

GTBoon72 commented Sep 13, 2023

Played a bit around with magick, and this looks promising. It's not so using partly transparent frames, but a black-and-white mask.

Start script

library(magick)
map <- image_read('https://user-images.githubusercontent.com/46410142/199815517-4da0d3f8-84a6-482c-83e7-c4e33d0dce7b.png')

get height, width and crop longer side to match shorter side

ii <- magick::image_info(map)
ii_min <- min(ii$width, ii$height)

create a new image with white background and black circle

mask <- magick::image_draw(image_blank(ii_min, ii_min))
symbols(ii_min/2, ii_min/2, circles=(ii_min/2)-3, bg='black', inches=FALSE, add=TRUE)
dev.off()

create an image composite using both images

combo <-
magick::image_composite(map, mask, gravity='center', operator='copyopacity')

set background as white

magick::image_background(combo, 'white')

End script

Result:
combo

@benyamindsmith
Copy link
Owner Author

Wow this looks beautiful! I wonder how I can fit it in the present way mapBliss works.

If you look at frames.R you'll see that the one frame mask I worked on so far is based on CSS.

I will try to work on this when I get the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants