mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-23 07:27:41 +01:00
add option in config.yaml to use png for avatar thumbs
This commit is contained in:
parent
18445f527b
commit
f862ffafd2
@ -25,6 +25,9 @@ autorun: true
|
|||||||
disableThumbnails: false
|
disableThumbnails: false
|
||||||
# Thumbnail quality (0-100)
|
# Thumbnail quality (0-100)
|
||||||
thumbnailsQuality: 95
|
thumbnailsQuality: 95
|
||||||
|
# Generate avatar thumbnails as PNG instead of JPG (preserves transparency but increases filesize by about 100%)
|
||||||
|
# Changing this only affects new thumbnails. To recreate the old ones, clear out your ST/thumbnails/ folder.
|
||||||
|
avatarThumbnailsPng: false
|
||||||
# Allow secret keys exposure via API
|
# Allow secret keys exposure via API
|
||||||
allowKeysExposure: false
|
allowKeysExposure: false
|
||||||
# Skip new default content checks
|
# Skip new default content checks
|
||||||
|
@ -111,7 +111,8 @@ async function generateThumbnail(type, file) {
|
|||||||
try {
|
try {
|
||||||
const quality = getConfigValue('thumbnailsQuality', 95);
|
const quality = getConfigValue('thumbnailsQuality', 95);
|
||||||
const image = await jimp.read(pathToOriginalFile);
|
const image = await jimp.read(pathToOriginalFile);
|
||||||
buffer = await image.cover(mySize[0], mySize[1]).quality(quality).getBufferAsync('image/jpeg');
|
const imgType = type == 'avatar' && getConfigValue('avatarThumbnailsPng', false) ? 'image/png' : 'image/jpeg';
|
||||||
|
buffer = await image.cover(mySize[0], mySize[1]).quality(quality).getBufferAsync(imgType);
|
||||||
}
|
}
|
||||||
catch (inner) {
|
catch (inner) {
|
||||||
console.warn(`Thumbnailer can not process the image: ${pathToOriginalFile}. Using original size`);
|
console.warn(`Thumbnailer can not process the image: ${pathToOriginalFile}. Using original size`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user