Page 1 of 1

Overlay Images using ImageMagick (6.9.9.18) Version and Knitr (Version 3.4)

Posted: 2017-12-06T15:07:54-07:00
by hy0723
I am trying to create a report in R Markdown (Version 1.0.153, Mac OS X 10_13_1) with an html output to embed multiple MRI images of the brain using a vertical scrollbar, but also overlay certain images.

I am very new to coding so am not sure how difficult my problem is, or if the packages I'm currently using work together. I have viewed the following post https://www.imagemagick.org/discourse-s ... hp?t=31518 but still cannot find the answer.

Currently, I am using the function knitr::include_graphics to display my images when knit to HTML and css styling. I have 4 jpg images that I can currently scroll through using the following code in R markdown:

Code: Select all

<div class="vscroll-plot">
```{r echo=FALSE, out.width='100%', fig.align="center"}
library(knitr)
knitr::include_graphics('1.jpg')
knitr::include_graphics('2.jpg')
knitr::include_graphics('3.jpg')
knitr::include_graphics('4.jpg')
```
</div>
With the CSS style:

Code: Select all

.vscroll-plot {
    width: 910px;
    height: 600px;
    overflow-y: scroll;
    overflow-x: hidden;
}
My question is, how can I use ImageMagick to overlay jpg 1+2, and jpg 3+4, while still maintaining the scroll function (between the 2 resultant images). Is this possible using both knitr (Version 3.4) and ImageMagick (Version 6.9.9.18)?

Any help is appreciated, as the link I've described previously was above my level of understanding. Thank you.

Re: Overlay Images using ImageMagick (6.9.9.18) Version and Knitr (Version 3.4)

Posted: 2017-12-06T15:58:27-07:00
by fmw42
I doubt any of us know all your other tools. It would be better if you can show an example of your input and desired resulting images.

Re: Overlay Images using ImageMagick (6.9.9.18) Version and Knitr (Version 3.4)

Posted: 2017-12-07T01:05:52-07:00
by Bonzo
I can see some code that looks like it came from a webpage so is your page an html one?

Re: Overlay Images using ImageMagick (6.9.9.18) Version and Knitr (Version 3.4)

Posted: 2017-12-07T16:01:37-07:00
by hy0723
Yes the desired output is html!

Re: Overlay Images using ImageMagick (6.9.9.18) Version and Knitr (Version 3.4)

Posted: 2017-12-07T16:19:51-07:00
by fmw42
ImageMagick does not create HTML pages. You would have to combine your images and then put them into HTML.