Skip to content

Commit

Permalink
Merge branch 'main' into init
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuang11 authored Mar 18, 2024
2 parents 7d7df03 + 66511bd commit 07ff387
Showing 1 changed file with 28 additions and 17 deletions.
45 changes: 28 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@

## 🔥 Enjoy animating!

Streamjoy merges images into animations--meticulously designed with sensible defaults and tested to ensure maximum enjoyment and minimal effort.
Streamjoy turns your images into animations using sensible defaults for fun, hassle-free creation.

It cuts down the boilerplate and time to work on animations, and it's simple to start with just a few lines of code.

Install it with pip.
Install it with just pip!

```python
pip install streamjoy
```

## 🛠️ Built-in features

🌐 Animate from URLs, files, and datasets
🎨 Render images with default or custom renderers
🎬 Provide context with a short intro splash
⏸ Add pauses at the beginning, end, or between frames
⚡ Execute read, render, write in parallel
🔗 Connect multiple animations together
- 🌐 Animate from URLs, files, and datasets
- 🎨 Render images with default or custom renderers
- 🎬 Provide context with a short intro splash
- ⏸ Add pauses at the beginning, end, or between frames
- ⚡ Execute read, render, and write in parallel
- 🔗 Connect multiple animations together

## 🚀 Quick start

Expand All @@ -36,6 +37,8 @@ resources = [URL_FMT.format(i=i) for i in range(1, 11)]
stream(resources, uri="goes.gif") # .gif and .mp4 supported
```

<img src="https://github.com/ahuang11/streamjoy/assets/15331990/a78b8b5e-bd28-4df2-aecb-6211cf3bb956" width="500" height="500">

Specify a few more keywords to:

1. add an intro title and subtitle
Expand All @@ -48,16 +51,19 @@ URL_FMT = "https://www.goes.noaa.gov/dimg/jma/fd/vis/{i}.gif"
resources = [URL_FMT.format(i=i) for i in range(1, 11)]
himawari_stream = stream(
resources,
uri="goes_custom.gif",
intro_title="Himawari Visible",
intro_subtitle="10 Hours Loop",
intro_pause=1,
ending_pause=1
)
himawari_stream
```

Preview the inputs by excluding `uri`.
<img src="https://github.com/ahuang11/streamjoy/assets/15331990/5bc4275e-8377-470d-9e20-524536316de9" width="500" height="500">

If you'd like to preview the `repr` before writing, drop `uri`.

Output:
```yaml
<AnyStream>
---
Expand Down Expand Up @@ -87,10 +93,10 @@ Resources: (10 frames to stream)
---
```

Then, simply add back `uri` or call the `write` method to save the animation!
Then, when ready, call the `write` method to save the animation!

```python
himawari_stream.write("goes_custom.gif")
himawari_stream.write()
```

Connect multiple streams together to provide further context.
Expand All @@ -115,6 +121,8 @@ infrared_stream = stream(
connect([visible_stream, infrared_stream], uri="goes_connected.gif")
```

<img src="https://github.com/ahuang11/streamjoy/assets/15331990/96e8477d-d70b-4c76-9ed4-55dad1e76393" width="500" height="500">

You can also render images directly from datasets, either through a custom renderer or a built-in one, and they'll also run in parallel!

```python
Expand Down Expand Up @@ -143,17 +151,20 @@ url = (
)
stream(
url,
np.linspace(-140, -150, 30), # iterables; central longitude per frame (30 frames)
renderer=plot, # base stream kwargs
uri="oisst.mp4",
pattern="oisst-avhrr-v02r01.*.nc", # Mp4Stream.from_url kwargs
max_files=30,
cmap="RdBu_r", # plot kwargs to be forwarded
vmin=-5,
vmax=5,
renderer=plot, # base stream kwargs
renderer_iterables=[np.linspace(-140, -150, 30)], # iterables; central longitude per frame (30 frames)
renderer_kwargs=dict(cmap="RdBu_r", vmin=-5, vmax=5), # renderer kwargs
# cmap="RdBu_r", # renderer_kwargs can also be propagated for convenience
# vmin=-5,
# vmax=5,
)
```

<img src="https://github.com/ahuang11/streamjoy/assets/15331990/59b9f620-926c-4ac3-819c-5859d8e44e12" width="500" height="500">

Read the full docs [here](https://ahuang11.github.io/streamjoy/).

---
Expand Down

0 comments on commit 07ff387

Please sign in to comment.