From 4cff7d0906fea33fa8cc6b0a4fcf4670b20c8434 Mon Sep 17 00:00:00 2001 From: Lukas Winkler Date: Tue, 8 Aug 2023 14:58:23 +0200 Subject: [PATCH] document a few useful cli commmands --- content/guide/converting-formats.md | 74 +++++++++++++++++++++++++++++ hugo_version.txt | 2 +- layouts/_default/single.html | 1 + 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 content/guide/converting-formats.md diff --git a/content/guide/converting-formats.md b/content/guide/converting-formats.md new file mode 100644 index 0000000..1c5f864 --- /dev/null +++ b/content/guide/converting-formats.md @@ -0,0 +1,74 @@ +--- +title: "How to quickly convert file formats" +date: 2023-08-08 +categories: + - collection + - file formats +author: Lukas Winkler +description: This is a collection of a few useful commands for converting files between formats that I use all the time. +cc_license: true +toc: true +--- + +This is a collection of a few useful commands for converting files between formats that I use all the time. + + + +## Audio + +### Audio → FLAC + +lossless if converting from e.g. WAV + +```bash +flac --best input.wav +``` + +### Audio → Opus + +Check [Opus Recommended Settings](https://wiki.xiph.org/Opus_Recommended_Settings) for the ideal bitrate for your use case. +24 Kb/s is a good basis for very small files that are still high quality for voice recordings. Only use `--downmix-mono` if you don't loose information by merging stereo audio to mono. + +```bash +opusenc --bitrate 24 --downmix-mono input.wav output.opus +``` + +## PDFs + +### PDF → Extracted Images + +```bash +mkdir tmp +pdfimages input.pdf -all tmp/name +``` + +This will extract all images that are contained in the input pdf to `tmp/name-000.png`, `tmp/name-001.jpg`, etc. + +### PDF → PNG + +```bash +pdftoppm input.pdf slides -png -scale-to 1080 -progress +``` + +This will generate images like `slides-1.png` for every page of the PDF with the specified width. With e.g. `-scale-to 3840` one can quickly convert a PDF of presentation slides to images for a high quality 4K video. + +### PDF → compressed PDF + +[source](https://askubuntu.com/questions/113544/how-can-i-reduce-the-file-size-of-a-scanned-pdf-file/256449#256449) + +Sometimes I have a PDF that is far too large (hundreds of MB for a simple document) because it was generated in an ineffcient way. Using ghostscript can in many cases reduce the file size dramatically while decreasing the quality only a bit. + +```bash +gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dPrinted=false -dNOPAUSE -dBATCH -sOutputFile=small.pdf input.pdf +``` + +Depending on the required quality, `/ebook` can be replaced with one of `/printer`, `/prepress` and `/default` (or `/screen` for a very bad quality). See the [documentation](https://ghostscript.readthedocs.io/en/latest/VectorDevices.html#controls-and-features-specific-to-postscript-and-pdf-input) for more information + +### PDF → PDF with OCR + +```bash +ocrmypdf -cdr --force-ocr input.pdf ocr.pdf -l deu +``` + +Check the [documentation](https://ocrmypdf.readthedocs.io/en/latest/cookbook.html) for more information. + diff --git a/hugo_version.txt b/hugo_version.txt index 8e56006..290ac6a 100644 --- a/hugo_version.txt +++ b/hugo_version.txt @@ -1 +1 @@ -0.111.3 \ No newline at end of file +0.117.0 \ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 1e12c4e..de8cc2f 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -23,6 +23,7 @@ {{ partial "toc.html" . }} {{ .Content }} +
{{ if not .Params.no_feedback }}
You have any feedback or ideas to improve this? Contact me on Social Media or per E-Mail or edit the