Skip to content
New: Star-import, signal unraveling, Python 3.12 support, and more

# image_ module

Utilities for images.

## hstack_image_arrays function

    hstack_image_arrays(
        a,
        b
    )

Stack NumPy images horizontally.

## save_animation function

    save_animation(
        fname,
        index,
        plot_func,
        *args,
        delta=None,
        step=1,
        fps=3,
        writer_kwargs=None,
        show_progress=True,
        pbar_kwargs=None,
        to_image_kwargs=None,
        **kwargs
    )

Save animation to a file.

Args

`fname` :`str`
  File name.
`index` :`sequence`
  Index to iterate over.
`plot_func` :`callable`

  Plotting function.

  Must take subset of `index`, `*args`, and `**kwargs`, and return either a Plotly figure, image that can be read by `imageio.imread`, or a NumPy array.

`*args`
  Positional arguments passed to `plot_func`.
`delta` :`int`
  Window size of each iteration.
`step` :`int`
  Step of each iteration.
`fps` :`int`

  Frames per second.

  Will be translated to `duration` by `1000 / fps`.

`writer_kwargs` :`dict`
  Keyword arguments passed to `imageio.get_writer`.
`show_progress` :`bool`
  Whether to show the progress bar.
`pbar_kwargs` :`dict`
  Keyword arguments passed to get_pbar().
`to_image_kwargs` :`dict`
  Keyword arguments passed to `plotly.graph_objects.Figure.to_image`.
`**kwargs`
  Keyword arguments passed to `plot_func`.

## vstack_image_arrays function

    vstack_image_arrays(
        a,
        b
    )

Stack NumPy images vertically.

#### Cookie consent

We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for. With your consent, you're helping us to make our documentation better.

- Google Analytics
- GitHub

Manage settings