Purge Unused ImageIO Binaries on Ubuntu with imageio_remove_bin

Overview

Working with Python’s imageio library for image and video processing often leaves behind cached third-party binaries—such as ffmpeg and freeimage—on your filesystem. This walkthrough demonstrates how to set up imageio_remove_bin on Ubuntu, locate the directory where cached binaries live, test plugin-specific cache removal, and safely reclaim disk space.

1. Installing python3-imageio and Locating the Binary

Begin by updating the package index and installing python3-imageio so the imageio_remove_bin utility becomes available on the system via apt-get update -qq && apt-get install -y python3-imageio.

Installing the python3-imageio package via apt-get

Next, verify where the system placed the executable by querying your $PATH with which imageio_remove_bin.
The output resolves to /usr/bin/imageio_remove_bin, confirming the command is ready to invoke globally.

Verifying the executable path with which imageio_remove_bin

To inspect all companion tools bundled alongside it, list the matching entries under /usr/bin/ using ls -la /usr/bin/imageio*.
Both imageio_download_bin and imageio_remove_bin appear in the listing, owned by root with executable permissions (-rwxr-xr-x) set across the board.

Listing imageio executables and permissions in /usr/bin

Confirm that Python imports the library cleanly and check which release is active by running python3 -c "import imageio; print('imageio version:', imageio.__version__)".
As shown in the terminal output, the environment is running imageio version 2.34.0.

Checking the installed Python imageio version

2. Finding the Cache Directory and Staging Test Files

Before deleting anything, ask imageio where it stores downloaded runtime assets by executing python3 -c "import imageio; print('Appdata dir:', imageio.core.appdata_dir('imageio'))".
The call returns Appdata dir: /root/.imageio, pinpointing /root/.imageio as the active cache root.

Querying the imageio application data directory path

Create dedicated plugin subdirectories for a safe hands-on test with mkdir -p ~/.imageio/ffmpeg ~/.imageio/freeimage.

Creating test subdirectories inside ~/.imageio

Populate the ffmpeg folder with a placeholder binary file by running echo 'dummy ffmpeg binary' > ~/.imageio/ffmpeg/ffmpeg-linux64-test.bin.

Creating a dummy ffmpeg binary file for testing

Similarly, place a mock shared library inside the freeimage folder using echo 'dummy freeimage binary' > ~/.imageio/freeimage/libfreeimage-test.so.

Creating a dummy freeimage library file for testing

Inspect the resulting directory hierarchy recursively via ls -R ~/.imageio.
The listing confirms that ffmpeg-linux64-test.bin sits inside /root/.imageio/ffmpeg, while libfreeimage-test.so resides under /root/.imageio/freeimage.

Recursively listing the staged test files in ~/.imageio

3. Targeting Plugin Caches with imageio_remove_bin

Run imageio_remove_bin ffmpeg to trigger binary cache cleanup for the ffmpeg backend.
The utility prints Removing binaries for: ffmpeg., indicating that it processed the target plugin.

Running imageio_remove_bin for the ffmpeg plugin

Check the contents of the ffmpeg folder with ls -la ~/.imageio/ffmpeg to verify what happened on disk.
Notice that the dummy ffmpeg-linux64-test.bin file created earlier remains untouched in the directory.

Checking ~/.imageio/ffmpeg after running imageio_remove_bin

Repeat the cleanup attempt for the freeimage plugin by invoking imageio_remove_bin freeimage.
Once again, the command outputs Removing binaries for: freeimage. to report that the cleanup routine ran.

Running imageio_remove_bin for the freeimage plugin

Verify the freeimage folder contents using ls -la ~/.imageio/freeimage.
Just as before, the placeholder libfreeimage-test.so file stays intact rather than being purged.

Checking ~/.imageio/freeimage after running imageio_remove_bin

4. Auditing Disk Usage and Wiping Test Artifacts

Measure the total footprint of the cache directory by executing du -sh ~/.imageio.
The summary reports 20K of disk usage under /root/.imageio.

Checking disk usage of ~/.imageio with du -sh

Perform another recursive inspection with ls -R ~/.imageio to review the entire remaining tree.
Both /root/.imageio/ffmpeg/ffmpeg-linux64-test.bin and /root/.imageio/freeimage/libfreeimage-test.so are still present on disk.

Verifying remaining files across ~/.imageio subdirectories

Remove the temporary subdirectories and dummy files cleanly by running rm -rf ~/.imageio/ffmpeg ~/.imageio/freeimage.

Removing test subdirectories from ~/.imageio

Run ls -la ~/.imageio one last time to confirm the directory is clear.
Only the . and .. entries remain, verifying that all test artifacts have been completely cleared out.

Confirming ~/.imageio is empty after cleanup

That wraps up inspecting imageio cache paths and testing imageio_remove_bin on Ubuntu. Checking and clearing stale plugin directories from time to time helps keep your filesystem tidy and prevents forgotten binary caches from piling up.