Resize PNG resolution to avoid large files
This commit is contained in:
parent
e9023909cf
commit
7906e1405d
@ -7,7 +7,7 @@
|
||||
"presAnnDropboxDir": "/tmp/pres-ann-dropbox"
|
||||
},
|
||||
"collector": {
|
||||
"backgroundSlidePPI": 350
|
||||
"pngWidthRasterizedSlides": 2048
|
||||
},
|
||||
"process": {
|
||||
"whiteboardTextEncoding": "utf-8",
|
||||
|
@ -70,14 +70,14 @@ let exportJob = JSON.parse(job);
|
||||
// CairoSVG doesn't handle transparent SVG and PNG embeds properly, e.g., in rasterized text.
|
||||
// So textboxes may get a black background when downloading/exporting repeatedly.
|
||||
// To avoid that, we take slides from the uploaded file, but later probe the dimensions from the SVG
|
||||
// so it matches what was shown in the browser -- Tldraw unfortunately uses absolute coordinates.
|
||||
// so it matches what was shown in the browser.
|
||||
|
||||
let extract_png_from_pdf = [
|
||||
'pdftocairo',
|
||||
'-png',
|
||||
'-f', pageNumber,
|
||||
'-l', pageNumber,
|
||||
'-r', config.collector.backgroundSlidePPI,
|
||||
'-scale-to', config.collector.pngWidthRasterizedSlides,
|
||||
'-singlefile',
|
||||
'-cropbox',
|
||||
pdfFile, outputFile,
|
||||
|
@ -796,14 +796,12 @@ for (let currentSlide of pages) {
|
||||
if (err) { return logger.error(err); }
|
||||
});
|
||||
|
||||
// Dimensions converted back to a pixel size which,
|
||||
// Dimensions converted to a pixel size which,
|
||||
// when converted to points, will yield the desired
|
||||
// dimension in pixels when read without conversion
|
||||
|
||||
// e.g. say Tldraw's canvas is 1920x1080 px.
|
||||
// The background SVG dimensions are set to 1920x1080 pt (incorrect unit).
|
||||
// So we read it in ignoring the unit as 1920x1080 px, making the position of the drawings match.
|
||||
// Now we assume we had 1920x1080pt and resize to 2560x1440 px so that the SVG generates with the original "wrong" size.
|
||||
// e.g. say the background SVG dimensions are set to 1920x1080 pt
|
||||
// Resize output to 2560x1440 px so that the SVG generates with the original size in pt.
|
||||
|
||||
let convertAnnotatedSlide = [
|
||||
'cairosvg',
|
||||
|
Loading…
Reference in New Issue
Block a user