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

Document best practices when adding images to documentation #153

Open
tjanez opened this issue Jul 7, 2022 · 1 comment
Open

Document best practices when adding images to documentation #153

tjanez opened this issue Jul 7, 2022 · 1 comment
Labels
images Images and diagrams assets related issues

Comments

@tjanez
Copy link
Member

tjanez commented Jul 7, 2022

Some obvious steps would be:

  1. Document how to choose an appropriate image format (JPG, PNG).
  2. Add CLI command that automatically reduces size of images.
  3. Document how to apply it before adding images to git history.
  4. Document how to sensibly name images.
@lukaw3d
Copy link
Member

lukaw3d commented Oct 31, 2022

For 1. and 2.:

shopt -s globstar
for i in docs/**/*.png; do
  # imagemagick to convert to sRGB color profile
  convert "$i" -profile /usr/share/color/icc/colord/sRGB.icc -strip "$i"
  # @squoosh/cli to reduce file size
  npx squoosh-cli \
    --quant '{"enabled": true, "zx": 0, "maxNumColors": 256, "dither": 1}' \
    --oxipng '{"level":2,"interlace":false}' --output-dir "`dirname $i`" "$i"
done
shopt -s globstar
for i in docs/**/*.jpg; do
  # imagemagick to convert to sRGB color profile
  convert "$i" -profile /usr/share/color/icc/colord/sRGB.icc -strip "$i"
  # @squoosh/cli to reduce file size
  npx squoosh-cli --mozjpeg '{"quality":75}' --output-dir "`dirname $i`" "$i"
done

@matevz matevz added the images Images and diagrams assets related issues label Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
images Images and diagrams assets related issues
Projects
None yet
Development

No branches or pull requests

3 participants