Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify example screenshots #2273

Closed
1 task
Tracked by #2266
nikolausWest opened this issue May 30, 2023 · 7 comments
Closed
1 task
Tracked by #2266

Unify example screenshots #2273

nikolausWest opened this issue May 30, 2023 · 7 comments
Assignees
Labels
📖 documentation Improvements or additions to documentation examples Issues relating to the Rerun examples

Comments

@nikolausWest
Copy link
Member

nikolausWest commented May 30, 2023

To improve the visual style and consistency of the examples page, all screenshots should follow the same style. More importantly this should also reduce the amount of decision making needed when adding screenshots.

My proposal:

  • Always screenshot the whole UI
    • Up to screenshotter what views should be visible and how they are aranged
  • No shadows or other added styling (easier to do in css)
  • Screenshot the web-viewer, excluding any browser elements this should
    • make it as consistent as possible across OSes
    • make the transition to showing live web-viewers much smoother

Example:
Screenshot 2023-05-30 at 11 52 44

TODO:

  • Find simple method to remove the rounded corners in the bottom when taking screenshots on platforms that add rounded corners to windows.
@nikolausWest nikolausWest added 📖 documentation Improvements or additions to documentation examples Issues relating to the Rerun examples labels May 30, 2023
@emilk
Copy link
Member

emilk commented May 30, 2023

@emilk
Copy link
Member

emilk commented Jun 12, 2023

Figure out workflow and document it:

@abey79 abey79 self-assigned this Jun 12, 2023
@jprochazk
Copy link
Member

jprochazk commented Jun 12, 2023

We should have scripts/upload_image.py produce a few different screenshot widths (while preserving the aspect ratio):

  • 480px
  • 768px
  • 1024px
  • 1200px
  • original

Instead of outputting a single link, the upload image script will output a responsive image element snippet after uploading all the image sizes:

<picture>
  <!-- responsive: -->
  <source media="(max-width: 480px)" srcset="https://static.rerun.io/HASH_FILENAME_480w.png" />
  <source media="(max-width: 768px)" srcset="https://static.rerun.io/HASH_FILENAME_768w.png" />
  <source media="(max-width: 1024px)" srcset="https://static.rerun.io/HASH_FILENAME_1024w.png" />
  <source media="(max-width: 1200px)" srcset="https://static.rerun.io/HASH_FILENAME_1200w.png" />
  <!-- fallback: -->
  <img src="https://static.rerun.io/HASH_FILENAME_orig.png" />
</picture>

This can still be directly pasted into a markdown file, and it should work in all browsers, becase unrecognized tags are treated as div tags.

The script currently supports uploading any kind of media to static.rerun.io, so this should only be done for png (or maybe even be behind a flag).

@jprochazk
Copy link
Member

CSS for a dropshadow so the images don't merge with our HTML background

#2399

@abey79
Copy link
Member

abey79 commented Jun 13, 2023

With automatic image stack creation and support for reading from clipboard in #2411, the workflow now looks like:

  1. run the example
  2. resize the viewer to some reasonable size (that is legible but smaller than fullscreen on your 4K/5K screen)
  3. groom the blueprint until it looks nice
  4. take a screenshot via the command palette
  5. just upload --name my_example_name
  6. Copy/paste the resulting HTML in the example's README

I think this workflow gets us pretty far until more automation with blueprints is possible. We could consider formalising (2) a little more, but I'm not sure the technical pain of enforcing this is worth the value.

@nikolausWest
Copy link
Member Author

Sounds great!

abey79 added a commit that referenced this issue Jun 13, 2023
…py (#2411)

### What

Create and upload multi-resolution stacks with `upload_image.py`

Clock example screenshot updated as an example of the result obtained.

Relates to #2273

TODO:
- [x] pngcrush stuff?
- [x] docs
- [x] test with jpg as well

### Usage

```sh
$ just upload --help
python3 "scripts/upload_image.py" --help
usage: upload_image.py [-h] [--single] [--name NAME] [--skip-pngcrush] [--debug] [path]

Upload an image.

positional arguments:
  path             File path to the image. If not provided, use the clipboard's content.

options:
  -h, --help       show this help message and exit
  --single         Upload a single image instead of creating a multi-resolution stack.
  --name NAME      Image name (required when uploading from clipboard).
  --skip-pngcrush  Skip PNGCrush.
  --debug          Enable debug logging.
```

### Example output


```
INFO:root:Base image width: 2348px
INFO:root:Resizing to: 480px
INFO:root:Resizing to: 768px
INFO:root:Resizing to: 1024px
INFO:root:Resizing to: 1200px
INFO:root:pngcrush reduced size from 76341 to 71599 bytes
INFO:root:Uploading 30a2659cb4f9b6ac39c808c3312a3f89b71d040c_clock_480w.png (size: 71599, type: image/png, encoding: None)
INFO:root:pngcrush reduced size from 145632 to 134514 bytes
INFO:root:Uploading acfb95102e353d67d0525e3a3d40fbe7f0ed638f_clock_768w.png (size: 134514, type: image/png, encoding: None)
INFO:root:pngcrush reduced size from 208771 to 188959 bytes
INFO:root:Uploading 7b1b0435cd8de9318c301036853d5c0d190b155f_clock_1024w.png (size: 188959, type: image/png, encoding: None)
INFO:root:pngcrush reduced size from 254562 to 231188 bytes
INFO:root:Uploading 51938f84bdb0df1baa1d72e09f2a1daac6e66d1c_clock_1200w.png (size: 231188, type: image/png, encoding: None)
INFO:root:pngcrush reduced size from 293024 to 265268 bytes
INFO:root:Uploading 4040806d866f246eda1a1434f3a1ab083764eb56_clock_full.png (size: 265268, type: image/png, encoding: None)

<picture>
  <source media="(max-width: 480px)" srcset="https://static.rerun.io/30a2659cb4f9b6ac39c808c3312a3f89b71d040c_clock_480w.png">
  <source media="(max-width: 768px)" srcset="https://static.rerun.io/acfb95102e353d67d0525e3a3d40fbe7f0ed638f_clock_768w.png">
  <source media="(max-width: 1024px)" srcset="https://static.rerun.io/7b1b0435cd8de9318c301036853d5c0d190b155f_clock_1024w.png">
  <source media="(max-width: 1200px)" srcset="https://static.rerun.io/51938f84bdb0df1baa1d72e09f2a1daac6e66d1c_clock_1200w.png">
  <img src="https://static.rerun.io/4040806d866f246eda1a1434f3a1ab083764eb56_clock_full.png" alt="">
</picture>
```



### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [ ] I've included a screenshot or gif (if applicable)

<!-- This line will get updated when the PR build summary job finishes.
-->
PR Build Summary: https://build.rerun.io/pr/2411

<!-- pr-link-docs:start -->
Docs preview: https://rerun.io/preview/479fa5f/docs
Examples preview: https://rerun.io/preview/479fa5f/examples
<!-- pr-link-docs:end -->
emilk pushed a commit that referenced this issue Jun 15, 2023
…py (#2411)

### What

Create and upload multi-resolution stacks with `upload_image.py`

Clock example screenshot updated as an example of the result obtained.

Relates to #2273

TODO:
- [x] pngcrush stuff?
- [x] docs
- [x] test with jpg as well

### Usage

```sh
$ just upload --help
python3 "scripts/upload_image.py" --help
usage: upload_image.py [-h] [--single] [--name NAME] [--skip-pngcrush] [--debug] [path]

Upload an image.

positional arguments:
  path             File path to the image. If not provided, use the clipboard's content.

options:
  -h, --help       show this help message and exit
  --single         Upload a single image instead of creating a multi-resolution stack.
  --name NAME      Image name (required when uploading from clipboard).
  --skip-pngcrush  Skip PNGCrush.
  --debug          Enable debug logging.
```

### Example output


```
INFO:root:Base image width: 2348px
INFO:root:Resizing to: 480px
INFO:root:Resizing to: 768px
INFO:root:Resizing to: 1024px
INFO:root:Resizing to: 1200px
INFO:root:pngcrush reduced size from 76341 to 71599 bytes
INFO:root:Uploading 30a2659cb4f9b6ac39c808c3312a3f89b71d040c_clock_480w.png (size: 71599, type: image/png, encoding: None)
INFO:root:pngcrush reduced size from 145632 to 134514 bytes
INFO:root:Uploading acfb95102e353d67d0525e3a3d40fbe7f0ed638f_clock_768w.png (size: 134514, type: image/png, encoding: None)
INFO:root:pngcrush reduced size from 208771 to 188959 bytes
INFO:root:Uploading 7b1b0435cd8de9318c301036853d5c0d190b155f_clock_1024w.png (size: 188959, type: image/png, encoding: None)
INFO:root:pngcrush reduced size from 254562 to 231188 bytes
INFO:root:Uploading 51938f84bdb0df1baa1d72e09f2a1daac6e66d1c_clock_1200w.png (size: 231188, type: image/png, encoding: None)
INFO:root:pngcrush reduced size from 293024 to 265268 bytes
INFO:root:Uploading 4040806d866f246eda1a1434f3a1ab083764eb56_clock_full.png (size: 265268, type: image/png, encoding: None)

<picture>
  <source media="(max-width: 480px)" srcset="https://static.rerun.io/30a2659cb4f9b6ac39c808c3312a3f89b71d040c_clock_480w.png">
  <source media="(max-width: 768px)" srcset="https://static.rerun.io/acfb95102e353d67d0525e3a3d40fbe7f0ed638f_clock_768w.png">
  <source media="(max-width: 1024px)" srcset="https://static.rerun.io/7b1b0435cd8de9318c301036853d5c0d190b155f_clock_1024w.png">
  <source media="(max-width: 1200px)" srcset="https://static.rerun.io/51938f84bdb0df1baa1d72e09f2a1daac6e66d1c_clock_1200w.png">
  <img src="https://static.rerun.io/4040806d866f246eda1a1434f3a1ab083764eb56_clock_full.png" alt="">
</picture>
```



### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [ ] I've included a screenshot or gif (if applicable)

<!-- This line will get updated when the PR build summary job finishes.
-->
PR Build Summary: https://build.rerun.io/pr/2411

<!-- pr-link-docs:start -->
Docs preview: https://rerun.io/preview/479fa5f/docs
Examples preview: https://rerun.io/preview/479fa5f/examples
<!-- pr-link-docs:end -->
@abey79
Copy link
Member

abey79 commented Jun 16, 2023

Closed by #2440

@abey79 abey79 closed this as completed Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📖 documentation Improvements or additions to documentation examples Issues relating to the Rerun examples
Projects
None yet
Development

No branches or pull requests

4 participants