Add thumbnails quality config

This commit is contained in:
Cohee 2023-09-16 21:53:30 +03:00
parent bfdd071001
commit 2c84c93f3d
3 changed files with 5 additions and 3 deletions

View File

@ -9,7 +9,7 @@ const enableExtensions = true; //Enables support for TavernAI-extras project
const listen = true; // If true, Can be access from other device or PC. otherwise can be access only from hosting machine.
const allowKeysExposure = false; // If true, private API keys could be fetched to the frontend.
const skipContentCheck = false; // If true, no new default content will be delivered to you.
const thumbnailsQuality = 95; // Quality of thumbnails. 0-100
// If true, Allows insecure settings for listen, whitelist, and authentication.
// Change this setting only on "trusted networks". Do not change this value unless you are aware of the issues that can arise from changing this setting and configuring a insecure setting.
@ -47,5 +47,6 @@ module.exports = {
securityOverride,
skipContentCheck,
requestOverrides,
thumbnailsQuality,
extras,
};

View File

@ -338,7 +338,7 @@ export async function favsToHotswap() {
// don't fill leftover spaces with avatar placeholders
// just evenly space the selected avatars instead
/*
/*
if (count < maxCount) { //if any space is left over
let leftOverSlots = maxCount - count;
for (let i = 1; i <= leftOverSlots; i++) {

View File

@ -107,8 +107,9 @@ async function generateThumbnail(type, file) {
let buffer;
try {
const quality = getConfigValue('thumbnailsQuality', 95);
const image = await jimp.read(pathToOriginalFile);
buffer = await image.cover(mySize[0], mySize[1]).quality(95).getBufferAsync('image/jpeg');
buffer = await image.cover(mySize[0], mySize[1]).quality(quality).getBufferAsync('image/jpeg');
}
catch (inner) {
console.warn(`Thumbnailer can not process the image: ${pathToOriginalFile}. Using original size`);