Optimizing JPG and PNG files for the web

I often post images on the web but I rarely think about optimizing the files properly before uploading. Here is a solution for how to do it programmatically in the terminal. Asking ChatGPT for help ChatGPT is great for some things, including suggesting program code for well-known problems. However, while it came up with something that worked right from the start, it took a few iterations to come up with a solution that does what I want. I wanted it to work on all image files in all the subfolders (using a recursive search), reduce the images to maxium 1920 pixels, and optimize them without recompression. ...

July 5, 2024 · 4 min · 781 words · ARJ

Data, Metadata and Paradata

I have had some interesting discussions about what constitutes metadata these days. What is really the difference between metadata and data? While participating in ESOF today, I came across the term paradata, which was new to me. What is that, and how does it differ from data and metadata? Data Data refers to raw facts, observations, measurements, or representations of information in various formats, such as numbers, text, images, audio, or video. It is the foundation of knowledge and is essential for making informed decisions, conducting research, and gaining insights across various domains. ...

June 13, 2024 · 4 min · 775 words · ARJ

Converting Ambisonics files to Binaural audio

Ambisonics is a full-sphere surround sound format that captures audio from all directions using spherical harmonics. To convert it to binaural audio for headphone listening, you need to apply Head-Related Transfer Functions (HRTFs), mathematical models that simulate how sound waves interact with the human head and ears. HRTFs create the spatial cues necessary to perceive 3D sound direction and distance over stereo headphones. My favourite go-to-tool for converting media files, FFmpeg, unfortunately lacks native binaural rendering. However, it offers channel manipulation filters like amerge, channelmap, and pan. These provide basic channel operations but won’t produce true binaural audio. Here are some tips for how to make it work. ...

October 9, 2023 · 1 min · 199 words · ARJ

Which image format should I use?

Many image file formats exist, but which ones are better for what task? Here is a quick overview in my little series of PhD advice blog posts (the previous being tips on dissertation writing and the public PhD defense). Two different image types When choosing a file format for your image, the first thing is to figure out whether you are dealing with a raster image (photos) or a vector image (line illustrations). These are fundamentally different and should be stored with particular file formats. ...

September 26, 2023 · 4 min · 679 words · ARJ

Editing PDF metadata

Sometimes it is necessary to check, remove or modify the metadata of PDF files. Here is a quick post to show how it can be done in the terminal on Ubuntu Checking PDF metadata Most PDF viewers have an option for showing the metadata of PDF files. This can also be done in the terminal using the “pdfinfo” command-line tool. First, we need to install the “poppler-utils” package: sudo apt install poppler-utils Once installed, you can check the metadata by using the following command: ...

April 10, 2023 · 1 min · 186 words · ARJ

Adding Title and Author to PDFs exported from Jupyter Notebook

I am doing some end of the year cleaning on my hard drive and just uploaded the Jupyter Notebook I used in the analysis of a mobile phone lying still earlier this year. For some future studies, I thought it would be interesting to explore the PDF export functionality from Jupyter. That worked very well except for that I didn’t get any title or author name on top: ...

December 30, 2022 · 1 min · 127 words · ARJ

Scripting image exports with LibreOffice Draw

As mentioned yesterday, the source files for the illustrations in my Sound Actions book are available on GitHub in the form of LibreOffice Draw files (ODG). Draw may be less powerful but much easier to work with than more advanced line art software, such as Inkscape. One of the nice things about the LibreOffice package is its scripting possibilities. While working on my book, I wrote a shell script that would read all the ODG files in a folder and convert them to PDF and PNG files: ...

December 21, 2022 · 1 min · 210 words · ARJ

Optimizing JPEG files

I have previously written about how to resize all the images in a folder. That script was based on lossy compression of the files. However, there are also tools for optimizing image files losslessly. One approach is to use the.jpgoptim](https://github.com/tjko.jpgoptim) function available on ubuntu. Here is an excellent explanation of how it works. Lossless optimization As part of moving my blog to Hugo, I took the opportunity to optimize all the images in all my image folders. That was done with this one-liner: ...

December 9, 2022 · 1 min · 168 words · ARJ

Convert HEIC photos to JPEG

A quick note-to-self about how I managed to download a bunch of photos from an iPhone and convert them to.jpg on my laptop running Ubuntu 22.04. As opposed to Android phones, iPhones do not show up as a regular disk with easy access to the DCIM folder storing photos. Fortunately, Rapid Photo Downloader managed to launch the iPhone and find all the images. Unfortunately, all the files were stored as HEIC files, using the High Efficiency Image File Format. This format is technically good but practically tricky to work with. So I wanted to convert the files to.jpg. ...

September 18, 2022 · 1 min · 164 words · ARJ

Convert a folder of LibreOffice .ODT files to .DOCX files

I don’t spend much time in traditional “word processors”, but when I do, it is usually in LibreOffice. Then I prefer to save the files in the native .ODT format. But it happens that I need to send a bunch of files to someone that prefers .DOCX files. Instead of manually converting all the files, here is a short one-liner that does the trick using the magical pandoc, the go-to tool for converting text documents. ...

August 13, 2022 · 1 min · 107 words · ARJ