update logos, and image decoder settings in config
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 11 KiB |
@@ -23,6 +23,8 @@
|
||||
*
|
||||
* Decoder reverse-engineered from:
|
||||
* https://gist.github.com/PajamaFrix/399c0785c5bb3b1d80757e84a0c1d6ab
|
||||
*
|
||||
* TODO: Fix ALP Generation (decoding works but encoding does not yet produce correct ALP files)
|
||||
*/
|
||||
|
||||
const sharp = require('sharp');
|
||||
@@ -958,10 +960,23 @@ class WTVImage {
|
||||
* @param {number} [opts.colors=256] - palette size for full-color quantization
|
||||
* @param {'ALP'|'ALF'} [opts.type='ALF'] - Artemis variant
|
||||
* @param {number} [opts.jpegQuality=85] - JPEG quality (0-100) when no alpha
|
||||
* @param {number} [opts.maxWidth] - maximum width to scale to before encoding
|
||||
* @param {number} [opts.maxHeight] - maximum height to scale to before encoding
|
||||
* @returns {Promise<{ data: Buffer, mime: string }>}
|
||||
*/
|
||||
async ImageToWebTV(input, opts = {}) {
|
||||
const pngBuf = Buffer.isBuffer(input) ? input : require('fs').readFileSync(input);
|
||||
let pngBuf = Buffer.isBuffer(input) ? input : require('fs').readFileSync(input);
|
||||
const maxWidth = Number(opts.maxWidth) > 0 ? Number(opts.maxWidth) : null;
|
||||
const maxHeight = Number(opts.maxHeight) > 0 ? Number(opts.maxHeight) : null;
|
||||
if (maxWidth || maxHeight) {
|
||||
const resizeOpts = { fit: 'inside', withoutEnlargement: true };
|
||||
if (maxWidth) resizeOpts.width = maxWidth;
|
||||
if (maxHeight) resizeOpts.height = maxHeight;
|
||||
pngBuf = await sharp(pngBuf)
|
||||
.resize(resizeOpts)
|
||||
.png()
|
||||
.toBuffer();
|
||||
}
|
||||
const meta = await sharp(pngBuf).metadata();
|
||||
let usesAlpha = false;
|
||||
|
||||
@@ -989,8 +1004,10 @@ class WTVImage {
|
||||
|
||||
if (this.isPalettePNG(pngBuf)) {
|
||||
// Palette/indexed PNGs should preserve palette + tRNS alpha exactly by default.
|
||||
// Allow forcing re-quantization only when explicitly requested.
|
||||
const data = opts.forceRequantizePalette
|
||||
// If resizing was applied, the palette is no longer preserved and we must
|
||||
// re-quantize the image before producing an Artemis GIF.
|
||||
const forceRequantize = opts.forceRequantizePalette || maxWidth || maxHeight;
|
||||
const data = forceRequantize
|
||||
? await this.encodeArtemisGIF(pngBuf, opts)
|
||||
: await this.paletteImageToArtemisGIF(pngBuf, opts);
|
||||
return { data, mime: 'image/gif' };
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
"cgi_enabled": false, // Disable CGI by default
|
||||
"php_enabled": false, // Disable PHP by default
|
||||
"php_binpath": "php-cgi",
|
||||
"decode_unsupported_images": true, // Attempt to decode images WebTV doesn't support into JPG/ALF/GIF
|
||||
"decode_unsupported_images_quality": 75, // JPEG quality for decoded PNGs, 0-100 lower is worse quality but smaller files.
|
||||
"SessionStore": "SessionStore", // Where we store account (session) data. Best left unchanged.
|
||||
"SharedROMCache": "SharedROMCache", // Shared ROMCache (wtv-service:/ROMCache/, where wtv-service is any configured service). Found under service vault. Best left unchanged.
|
||||
"enable_shared_romcache": true, // Disabling this will cause a lot of problems without manual intervention. Best left unchanged.
|
||||
@@ -112,7 +110,23 @@
|
||||
Each level of shenanigans includes the previous level (eg 5 will also disable filters like 4)
|
||||
See WTVShenanigans.js for more info.
|
||||
*/
|
||||
"shenanigans": false
|
||||
"shenanigans": false,
|
||||
"image_decoder": {
|
||||
"enabled": true,
|
||||
"jpg_quality": 75,
|
||||
"image_formats": [
|
||||
"image/png",
|
||||
"image/svg+xml",
|
||||
"image/avif",
|
||||
"image/tiff",
|
||||
"image/webp"
|
||||
],
|
||||
"max_height": 0,
|
||||
"max_width": 640,
|
||||
"max_file_size": 524288,
|
||||
"jpeg_interval": 5, // lower quality by this amount to try to lower filesize
|
||||
"max_quality_tries": 5 // try to decode up to this many times, reducing quality each time, until the file is under the max_file_size. After this many tries, it will error out rather than sending an oversized file to the client.
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
// service definitions
|
||||
@@ -218,7 +232,7 @@
|
||||
"flags": "0x00000001",
|
||||
"privileged": true,
|
||||
"send_tellyscripts": true, // Best left untouched
|
||||
"send_tellyscript_to_mame": false,
|
||||
"send_tellyscript_to_mame": true,
|
||||
"dialin_number": 18006138199,
|
||||
"dns1ip": "10.0.0.50",
|
||||
"dns2ip": "8.8.8.8",
|
||||
|
||||
Reference in New Issue
Block a user