Add more info about convert-images.py
script
This commit is contained in:
parent
5a89bd0a79
commit
aed03b484d
2 changed files with 21 additions and 0 deletions
|
@ -2,9 +2,16 @@
|
|||
|
||||
My personal website.
|
||||
|
||||
|
||||
## Getting started
|
||||
|
||||
```bash
|
||||
npm i
|
||||
npm run dev
|
||||
```
|
||||
|
||||
|
||||
## Images
|
||||
|
||||
The original pictures are in the `public-src` directory.
|
||||
The `convert-images.py` script converts them into the required formats and resolutions.
|
||||
|
|
|
@ -9,6 +9,11 @@ def main():
|
|||
|
||||
|
||||
def convert_favicon():
|
||||
"""
|
||||
Generate different versions of an icon from a vector image.
|
||||
The function does not overwrite existing files.
|
||||
"""
|
||||
|
||||
root = 'public/favicon'
|
||||
src = f'{root}/vector.svg'
|
||||
|
||||
|
@ -37,7 +42,16 @@ def convert_favicon():
|
|||
print(' '.join(cmd))
|
||||
subprocess.run(cmd)
|
||||
|
||||
|
||||
def convert_images(src, dest):
|
||||
"""
|
||||
Convert all images from the public-src directory.
|
||||
The function does not overwrite existing files.
|
||||
|
||||
Example:
|
||||
public-src/subdir/1.jpg -> public/subdir/1.avif
|
||||
"""
|
||||
|
||||
for i in listdir(src):
|
||||
entry = join(src, i)
|
||||
|
||||
|
|
Loading…
Reference in a new issue