3 ms·
Nice, I’ll definitely check this out. You might want to look at optimising the PDF, it’s sitting at 40MB right now.
by quibono 6mo ago
Nice, I’ll definitely check this out.
You might want to look at optimising the PDF, it’s sitting at 40MB right now.
- Pay08 6mo agoDoes it matter?
- 2DcAf 6mo agoThanks! I think most of the weight comes from the PNG diagrams, but I don’t actually know: I’ll put it on my to-do list to investigate, maybe there are some easy wins here.
- freedomben 6mo agoClaude was able to optimize the hell out of one of mine, might be worth a try
- maxerickson 6mo agoThe ~750 pngs are about 15 megabytes. The 77 photographic images are 22 megabytes. Somewhat a death of 1000 cuts. I used https://www.xpdfreader.com/pdfimages-man.html https://www.xpdfreader.com/pdfimages-man.html to extract them and take a look.
- 2DcAf 6mo agoThanks for that. At first glance, it looks like that is a good place to be, regarding images. I will still investigate when I find time.
- maxerickson 6mo agoProbably the main thing you could look at is what pixel density you want in your images. For example, there's a 1 megabyte image of a tanker trailer that is displayed at about 1.5 x 3 inches, you could get rid of 3/4 of those pixels (going from ~400 ppi to ~200 ppi) and not really change the quality of the image for a casual reader.
- 2DcAf 6mo agothat’s a really good place to start, thank you!
- 2DcAf 5mo agoOne week later, a follow-up. I went through the largest JPG files and was able to shave 7 MB off the final PDF file size, with no noticeable drop in quality, as far as I can tell: https://framagit.org/olivier/thermodynamique/-/commit/0630385725642aa1da2d95a3b1e4b2d8a0d39f1f https://framagit.org/olivier/thermodynamique/-/commit/063038... As for the PNG files, I gave up after spending a whole day on them. I was able to compress them losslessly to save 6 MB, but this did not carry over into the PDF, where they are not embedded but re-encoded. The best way to save space here would be to switch to SVG, but this is too much work and last time I tried 12 years ago it did not work well. Alternatively, removing transparency would help (and anyway the source SVG is given for each file). But that’s not very future-proof and somewhere I know there’s a teacher who just is going to right-click-save a diagram and will get a nice crisp transparent-background PNG they can instantly reuse. Verdict: at this point, I am calling it good enough. :-)