# Multiple Images along the same row

**URL:** <https://discuss.streamlit.io/t/multiple-images-along-the-same-row/118>\
**Category:** Using Streamlit\
**Tags:** tutorial\
**Created:** [October 2, 2019, 6:27am UTC](https://discuss.streamlit.io/t/multiple-images-along-the-same-row/118 "2019-10-02T06:27:53Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhun\_t](https://avatars.discourse-cdn.com/v4/letter/z/c57346/32.png) [@zhun\_t](https://discuss.streamlit.io/u/zhun_t)\
**Post date:** [October 2, 2019, 6:27am UTC](https://discuss.streamlit.io/t/multiple-images-along-the-same-row/118/1 "2019-10-02T06:27:53Z")

</div>

Hi,

How can I present 2 images in the same row?

I’ve tried

```auto
st.image([image1,image2])

```

and

```auto
st.image(image1)
st.image(image2)

```

Both gives me the same result of images in a column.

---

<div class="post-metadata">

**Author:** ![zhun\_t](https://avatars.discourse-cdn.com/v4/letter/z/c57346/32.png) [@zhun\_t](https://discuss.streamlit.io/u/zhun_t)\
**Post date:** [October 2, 2019, 6:34am UTC](https://discuss.streamlit.io/t/multiple-images-along-the-same-row/118/2 "2019-10-02T06:34:40Z")

</div>

Update: I found that wide mode resolves this. However, im wondering if there are other ways to go about it?

---

<div class="post-metadata">

**Author:** ![Kalmouk](https://avatars.discourse-cdn.com/v4/letter/k/ce7236/32.png) [@Kalmouk](https://discuss.streamlit.io/u/Kalmouk)\
**Post date:** [October 2, 2019, 2:34pm UTC](https://discuss.streamlit.io/t/multiple-images-along-the-same-row/118/3 "2019-10-02T14:34:44Z")

</div>

How do you do it with wide please ?

---

<div class="post-metadata">

**Author:** ![yshvrdhn](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/yshvrdhn/32/122_2.png) [@yshvrdhn](https://discuss.streamlit.io/u/yshvrdhn)\
**Post date:** [October 2, 2019, 3:15pm UTC](https://discuss.streamlit.io/t/multiple-images-along-the-same-row/118/4 "2019-10-02T15:15:00Z")

</div>

use this st.image([image1,image2]) and go to the running instance on the browser -\> settings -\> Show app in wide mode.

---

<div class="post-metadata">

**Author:** ![Adrien\_Treuille](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/adrien_treuille/32/8_2.png) [@Adrien\_Treuille](https://discuss.streamlit.io/u/Adrien_Treuille)\
**Post date:** [October 2, 2019, 6:04pm UTC](https://discuss.streamlit.io/t/multiple-images-along-the-same-row/118/5 "2019-10-02T18:04:39Z")

</div>

Thanks for the great answer @yshvrdhn and welcome to the Streamlit community @zhun_t! ❤

Please note that `st.image` [also takes a `width` parameter](https://streamlit.io/docs/api.html?highlight=image#streamlit.image) which you can use to fit more pictures in a row.

We also [have plans](https://github.com/streamlit/streamlit/issues/241) to add more layout primitives to Streamlit. Please feel free to follow that issue to track its progress and add comments with addition use cases for us to consider.

---

<div class="post-metadata">

**Author:** ![yshvrdhn](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/yshvrdhn/32/122_2.png) [@yshvrdhn](https://discuss.streamlit.io/u/yshvrdhn)\
**Post date:** [October 2, 2019, 6:30pm UTC](https://discuss.streamlit.io/t/multiple-images-along-the-same-row/118/6 "2019-10-02T18:30:59Z")

</div>

@Adrien_Treuille thank you ! and kudos for building such an amazing tool :). Hi I was wondering if there is an example for pagination for viewing 1000 images say 10 at a time or so ?

---

<div class="post-metadata">

**Author:** ![Adrien\_Treuille](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/adrien_treuille/32/8_2.png) [@Adrien\_Treuille](https://discuss.streamlit.io/u/Adrien_Treuille)\
**Post date:** [October 2, 2019, 6:34pm UTC](https://discuss.streamlit.io/t/multiple-images-along-the-same-row/118/7 "2019-10-02T18:34:14Z")

</div>

Yes. I’m working on a short pagination example now. Will share with you when I’m done!

…and thanks for the compliment! 😊 We’re happy to have you as a user, @yshvrdhn!

---

<div class="post-metadata">

**Author:** ![Adrien\_Treuille](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/adrien_treuille/32/8_2.png) [@Adrien\_Treuille](https://discuss.streamlit.io/u/Adrien_Treuille)\
**Post date:** [October 2, 2019, 7:49pm UTC](https://discuss.streamlit.io/t/multiple-images-along-the-same-row/118/8 "2019-10-02T19:49:17Z")

</div>

Hi @yshvrdhn!

One way to do image pagination would be to copy-paste the `paginator` function from [this gist](https://gist.github.com/treuille/2ce0acb6697f205e44e3e0f576e810b7) and use it as follows:

```python
sunset_imgs = [
    'https://unsplash.com/photos/-IMlv9Jlb24/download?force=true',
    'https://unsplash.com/photos/ESEnXckWlLY/download?force=true',
    'https://unsplash.com/photos/mOcdke2ZQoE/download?force=true',
    'https://unsplash.com/photos/GPPAjJicemU/download?force=true',
    'https://unsplash.com/photos/JFeOy62yjXk/download?force=true',
    'https://unsplash.com/photos/kEgJVDkQkbU/download?force=true',
    'https://unsplash.com/photos/i9Q9bc-WgfE/download?force=true',
    'https://unsplash.com/photos/tIL1v1jSoaY/download?force=true',
    'https://unsplash.com/photos/-G3rw6Y02D0/download?force=true',
    'https://unsplash.com/photos/xP_AGmeEa6s/download?force=true',
    'https://unsplash.com/photos/4iTVoGYY7bM/download?force=true',
    'https://unsplash.com/photos/mBQIfKlvowM/download?force=true',
    'https://unsplash.com/photos/A-11N8ItHZo/download?force=true',
    'https://unsplash.com/photos/kOqBCFsGTs8/download?force=true',
    'https://unsplash.com/photos/8DMuvdp-vso/download?force=true'
]
image_iterator = paginator("Select a sunset page", sunset_imgs)
indices_on_page, images_on_page = map(list, zip(*image_iterator))
st.image(images_on_page, width=100, caption=indices_on_page)

```

In fact, you can try this right now by running:

```bash
streamlit run https://gist.githubusercontent.com/treuille/da70b4888f8b706fca7afc765751cd85/raw/0727bb67defd93774dae65a2bc6917f72e267460/image_paginator.py

```

This is what you will see:

 ![image](https://global.discourse-cdn.com/streamlit/original/1X/064a8fbd6853b3076b246c5e1240286107c5b925.jpeg)

* * *

 ![image](https://global.discourse-cdn.com/streamlit/original/1X/b2a6feec257d0f503ef05039f4864c360dad0240.jpeg)

---

<div class="post-metadata">

**Author:** ![zhun\_t](https://avatars.discourse-cdn.com/v4/letter/z/c57346/32.png) [@zhun\_t](https://discuss.streamlit.io/u/zhun_t)\
**Post date:** [October 3, 2019, 2:14am UTC](https://discuss.streamlit.io/t/multiple-images-along-the-same-row/118/9 "2019-10-03T02:14:58Z")

</div>

Hi @Adrien_Treuille, thank you for the response! Appreciate it!

---

<div class="post-metadata">

**Author:** ![casfranco](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/casfranco/32/2466_2.png) [@casfranco](https://discuss.streamlit.io/u/casfranco)\
**Post date:** [July 15, 2020, 10:30am UTC](https://discuss.streamlit.io/t/multiple-images-along-the-same-row/118/10 "2020-07-15T10:30:00Z")

</div>

Hi @Adrien_Treuille, great function, thank you. Small question. Is it possible to add legends for each display image (for instance, the filename)?

---

<div class="post-metadata">

**Author:** ![Venkatesh\_S](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/venkatesh_s/32/3438_2.png) [@Venkatesh\_S](https://discuss.streamlit.io/u/Venkatesh_S)\
**Post date:** [October 11, 2020, 5:22pm UTC](https://discuss.streamlit.io/t/multiple-images-along-the-same-row/118/11 "2020-10-11T17:22:48Z")

</div>

Hi @casfranco - We have an option for `st.image` called caption.

`st.image(images_on_page, width=200, caption=images_on_page)`

`images_on_page` is a list of names you want to display as legends

---

<div class="post-metadata">

**Author:** ![Soren](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/soren/32/3255_2.png) [@Soren](https://discuss.streamlit.io/u/Soren)\
**Post date:** [December 11, 2020, 5:48am UTC](https://discuss.streamlit.io/t/multiple-images-along-the-same-row/118/12 "2020-12-11T05:48:37Z")

</div>

Is there a way to show ~100 images in a paginated way, ideally without reloading the whole page every time a next page is selected?

---

<div class="post-metadata">

**Author:** ![eri3l](https://avatars.discourse-cdn.com/v4/letter/e/3ab097/32.png) [@eri3l](https://discuss.streamlit.io/u/eri3l)\
**Post date:** [February 13, 2021, 7:22am UTC](https://discuss.streamlit.io/t/multiple-images-along-the-same-row/118/13 "2021-02-13T07:22:35Z")

</div>

Hey @Venkatesh_S, thanks for your input.

I keep getting an error when I try to do a caption with multiple images though. For example:

```
images = ['P2100483.JPG', 'P2100486.JPG', 'P2100488.JPG']
st.image(images, use_column_width=True, caption="some generic text")

AssertionError: Cannot pair 1 captions with 4 images.

```

Does this mean the caption passed needs to be a list of the same size as the image list? Do you know if you could pass one (same) caption for all images, without it being a list?

Many thanks 🙂

---

<div class="post-metadata">

**Author:** ![Haider\_Alwasiti](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/haider_alwasiti/32/5785_2.png) [@Haider\_Alwasiti](https://discuss.streamlit.io/u/Haider_Alwasiti)\
**Post date:** [February 13, 2021, 2:05pm UTC](https://discuss.streamlit.io/t/multiple-images-along-the-same-row/118/14 "2021-02-13T14:05:45Z")

</div>

> [@eri3l](#):
>
> Does this mean the caption passed needs to be a list of the same size as the image list?

yes.

You can do it like this:

```auto
images = ['P2100483.JPG', 'P2100486.JPG', 'P2100488.JPG']
st.image(images, use_column_width=True, caption=["some generic text"] * len(images))

```

---

<div class="post-metadata">

**Author:** ![randyzwitch](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/randyzwitch/32/58772_2.png) [@randyzwitch](https://discuss.streamlit.io/u/randyzwitch)\
**Post date:** [May 13, 2022, 8:43pm UTC](https://discuss.streamlit.io/t/multiple-images-along-the-same-row/118/15 "2022-05-13T20:43:22Z")

</div>


