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

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
hy0723
Posts: 2
Joined: 2017-12-06T14:57:33-07:00
Authentication code: 1152

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

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

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

Post by Bonzo »

I can see some code that looks like it came from a webpage so is your page an html one?
hy0723
Posts: 2
Joined: 2017-12-06T14:57:33-07:00
Authentication code: 1152

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

Post by hy0723 »

Yes the desired output is html!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post by fmw42 »

ImageMagick does not create HTML pages. You would have to combine your images and then put them into HTML.
Post Reply