fix: respect PREVIEW.image_quality for the default PDF previewer (#2006)

Co-authored-by: sxyazi <sxyazi@gmail.com>
This commit is contained in:
gaesa 2024-12-07 12:08:16 +00:00 committed by GitHub
parent 3bd625a8af
commit adb1426539
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -27,7 +27,7 @@ function M:preload(job)
"-resize",
string.format("%dx%d^", PREVIEW.max_width, PREVIEW.max_height),
"-quality",
tostring(PREVIEW.image_quality),
PREVIEW.image_quality,
"-auto-orient",
"JPG:" .. tostring(cache),
}):status()

View file

@ -26,7 +26,15 @@ function M:preload(job)
end
local output = Command("pdftoppm")
:args({ "-singlefile", "-jpeg", "-jpegopt", "quality=75", "-f", tostring(job.skip + 1), tostring(job.file.url) })
:args({
"-singlefile",
"-jpeg",
"-jpegopt",
"quality=" .. PREVIEW.image_quality,
"-f",
job.skip + 1,
tostring(job.file.url),
})
:stdout(Command.PIPED)
:stderr(Command.PIPED)
:output()