July 30, 2021

Auto-add 4K and HDR banners to your poster art in Plex

Automatically add 4k banners to your posters in Plex

Auto-add 4K and HDR banners to your poster art in Plex

If like me, you like to see which of your media files are 4k and HDR at a glance when scrolling though your media or keeping separate libraries then you may have gone down the rabbit hole of manually adding the 4k banners to your poster art in Plex. If you have gone down this hole, then you know just how deep it goes and how much of a manual process it can be.

The streaming brain is getting smarter, to the point now where I no longer keep a separate library or even split my 4k and HD versions of my films. Plex is, on the most part, smart enough to choose the best resolution to play or transcode. This means that apart from clicking on a film, or setting a filter, there was no way for me to see whether a film was 4k/HDR. And I like to see that when browsing through. In the past that meant manually adding a custom poster for all of my 4k media.

The process was easy but time consuming. Usually consisting of me filtering my library, looking at what 4k films I had that were missing posters, finding a decent poster on somewhere like theposterdb, importing that into coverlabs.io and then manually importing this into plex.

No more I say!!

I don't have the time any more to go through all that, for what is essentially a bit of a flex. But as I am trying to learn new things and Python scripting is one of them, I thought, hey, I wonder if I can manually add a 4k banner template to a poster.

After a few weeks of tinkering, I finally have it sorted. The script will go through the library of your choice, it will then download the poster you have selected and add the 4k banner. It will even add a HDR banner to the side of the poster too if you want it to.

What's more is it will even check whether your posters already have the 4k banner or HDR banner already applied to them, and if they do, they will skip it and move onto the next one.

One of the things I learned when I was testing this was, if you screw up, or want to make a change to, say, remove the HDR banner, was manually changing back all the posters sucked.  As I did when I realised that the title was behind the HDR banner in most posters in the original position. I added a function of the script to create a backup of the poster before the changes were made, and saved it in the same folder as the media.

This means that if you decide at a later date that you want to undo anything, you can restore all your posters to how they were before without having to manually go through your library.

Another great thing about this script is that you can change the poster art for any of your films and the next time the script runs, it will add the banners.  Though, you will need to delete the backup poster in order to re-create the backup.

That sounds awesome, how do I do it?

To make things as easy as possible, and to make it easier to run the scripts across different platforms, I have created a docker container that has python and all of the dependencies already installed. So all you have to do is change the config file to select which scripts you want to run and then let it do it's thing.

To run on Windows/Linux/MacOS enter a command prompt and enter the following line:

docker run -d --name=plex-utills -v <your plex media directory>:/films -v <your_config_file_directory>:/config -e EZ=europe/london jkirkcaldy/plex-utills

Alternatively if you prefer docker compose:

version: "3"

services:
    plex-utills:
        image: jkirkcaldy/plex-utills
        container_name: plex-utills
        restart: unless-stopped
        volumes: 
            - <your Plex media directory>:/films
            - <your config location>:/config
        environment: 
            - TZ=Europe/London

On Unraid, the container is in the Community App store, so simply head on over and search for plex-utills and install.

Change the settings to match your config and click install.


You then need to edit the config file to fit your needs.

[PLEXSERVER]
# Enter your plex details
PLEX_URL = http://your_plex_ip_address
TOKEN = <token>
FILMSLIBRARY = Films

#Use the setup helper if you don't know what to use here.
PLEXPATH = /media
# no trailing slash.
MOUNTEDPATH = /films


# Set to true to add a HDR banner, setting to False will only add the 4k Banner to your media. 
4k_hdr_posters = true
mini_4k = true
HDR_BANNER = TRUE
POSTER_BU = true

Disney = True
Pixar = true
hide_4k = False

#Set this to true, if you would like your server to create an optimised HD version of your 4K films. This is not reccomended on low powered hardware
transcode = false

[SCHEDULES]
#enter the time of day you want the script to run
poster_schedule = 23:00
disney_schedule = 22:00
pixar_schedule = 22:10
hide_poster_schedule = 01:00

One of the options you can set is whether you want to add full width 4k banners to your  posters or if you prefer you can add a minified 4k logo to the top left corner.

Once you are happy with your config file, simply restart the container and the scripts will run once a day at the time you set in the schedules part of the config.ini file and all of your 4k media will have 4k banners added, making it super easy to see your 4k media at a glance.