fixed bug where images with transparent margins wouldn't be scaled correctly
This commit is contained in:
parent
58219763c9
commit
d8598c0b8c
@ -16,8 +16,13 @@ Pip packages
|
||||
|
||||
## Site Display
|
||||
|
||||
* Pico CSS (Yohn's fork)
|
||||
* Linux Biolinum (font)
|
||||
### CSS
|
||||
|
||||
* Pico CSS ([fork](https://github.com/Yohn/PicoCSS))
|
||||
|
||||
### Fonts
|
||||
|
||||
* Linux Biolinum
|
||||
|
||||
# On Production Server
|
||||
|
||||
@ -34,16 +39,22 @@ Pip packages
|
||||
|
||||
## Event list
|
||||
|
||||
Python packages
|
||||
* utils/refresh-events.py
|
||||
depends on:
|
||||
* caldav
|
||||
* vobject
|
||||
|
||||
* caldav
|
||||
* vobject
|
||||
## image processing
|
||||
|
||||
* utils/crop_image_to_bbox.py
|
||||
depends on:
|
||||
* PIL
|
||||
|
||||
## Favicon
|
||||
|
||||
Linux packages:
|
||||
|
||||
* inkscape
|
||||
* pngquant
|
||||
* image-magick
|
||||
* utils/favicon-from-svg.sh
|
||||
depends on:
|
||||
* inkscape
|
||||
* pngquant
|
||||
* image-magick
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 969 KiB After Width: | Height: | Size: 796 KiB |
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.4 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 473 KiB After Width: | Height: | Size: 563 KiB |
@ -5,7 +5,7 @@ template: index
|
||||
save_as: index.html
|
||||
url:
|
||||
index_cards:
|
||||
- pic: images/kurzprosa/cover-aw-phantastische-geschichten-2.jpg
|
||||
- pic: images/kurzprosa/mockup-aw-phantastische-geschichten-2.png
|
||||
link: werke/
|
||||
alt: Phantastik, Belletristik, Lyrik & mehr
|
||||
- pic: images/tr/live-microphone-2.jpg
|
||||
@ -13,7 +13,7 @@ index_cards:
|
||||
credit_link: https://unsplash.com/@matthewjungling
|
||||
link: termine/
|
||||
alt: Lesungen und Lesereihen
|
||||
- pic: images/news/news-coffee.jpg
|
||||
- pic: images/neues/motif-coffee.jpg
|
||||
link: neues/
|
||||
alt: Neuerscheinungen, Ankündigungen etc.
|
||||
- pic: images/tr/portrait-tr-cutout.png
|
||||
|
||||
@ -119,8 +119,9 @@ PLUGINS = ["pelican.plugins.yaml_metadata", "pelican.plugins.image_process", "mi
|
||||
OPTIMIZE_IMAGES_DEV_MODE = True # disable optimization in dev mode
|
||||
|
||||
# plugin settings for image-process
|
||||
IMAGE_PROCESS_FORCE = False
|
||||
IMAGE_PROCESS = {
|
||||
"featured": ["scale_in 550 100% True"],
|
||||
"featured": ["scale_in 550 850 True"],
|
||||
"card": ["scale_in 350 100% True"]
|
||||
}
|
||||
|
||||
@ -132,4 +133,5 @@ IMAGE_PROCESS = {
|
||||
###############################################################################
|
||||
|
||||
STYLESHEET_FILES = ("pico.zinc.css", "custom.css")
|
||||
DEFAULT_METADESC = "Tobias Radloff ist preisgekrönter Schriftsteller von Romanen, Kurzgeschichten und Lyrik auf deutsch und englisch. Zu seinen Genres gehören Fantasy, SF, Krimi, Kinder-/Jugendbuch und mehr. Er organisiert und moderiert die regelmäßigen Lesereihen 'Potsdams andere Welten' und 'Babelsberger Lesesalon'."
|
||||
DEFAULT_METADESC = "Tobias Radloff ist preisgekrönter Schriftsteller von Romanen, Kurzgeschichten und Lyrik auf deutsch und englisch. Zu seinen Genres gehören Fantasy, SF, Krimi, Kinder-/Jugendbuch und mehr. Er organisiert und moderiert die regelmäßigen Lesereihen 'Potsdams andere Welten' und 'Babelsberger Lesesalon'."
|
||||
|
||||
|
||||
@ -422,7 +422,7 @@ figcaption {
|
||||
max-height: calc(var(--tr-card-height) * 2);
|
||||
min-width: var(--tr-smallest-width);
|
||||
max-width: 100%;
|
||||
object-fit: cover;
|
||||
object-fit: contain;
|
||||
display: block;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
20
utils/crop_image_to_bbox.py
Normal file
20
utils/crop_image_to_bbox.py
Normal file
@ -0,0 +1,20 @@
|
||||
from PIL import Image
|
||||
import sys
|
||||
|
||||
# check if filename is present
|
||||
if len(sys.argv) == 1:
|
||||
sys.exit("error: no filename spcified")
|
||||
f = sys.argv[1]
|
||||
|
||||
# open, crop and overwrite image
|
||||
print(f"cropping file {f} … ", end='')
|
||||
with Image.open(f) as i:
|
||||
# do nothing if size and bbox are equivalent
|
||||
bbox = i.getbbox()
|
||||
if bbox[0] == 0 and bbox[1] == 0 and bbox[2] == i.size[0] and bbox[3] == i.size[1]:
|
||||
print("nothing to do")
|
||||
sys.exit(0)
|
||||
|
||||
i.crop(i.getbbox()).save(f)
|
||||
|
||||
print("successful")
|
||||
Loading…
Reference in New Issue
Block a user