Replacing background images in Power BI easily

Published by Thomas foster on

Have you ever had to update the background image on a report with a lot of pages? Perhaps due to a corporate rebrand, or maybe you no longer like yellow. Whatever the reason, changing the background image on a bunch of pages at once is no fun task. However, there is an easier way which I will go into but first some background info, pun intended.

A fact that I feel is often under appreciated is the fact that Power BI files are in fact zipped archive files. This means you can unzip these files just by renaming the file extension and using a tool like windows explorer or 7zip. I believe this is partly how tools like the the Power BI helper work, but that is just speculation on my part.

Once you have unzipped this file you will see a few files and a folder called “Report”. Before I go any further with this, it is worth mentioning that none of this is supported by Microsoft and is liable to change at any time. So if you are reading this blog post in a few years time these methods may no longer work. I strongly recommend you back up any Power BI files before attempting this.

The structure of a typical .pbix file

For this post I will be diving into the Report folder, as this folder contains information about the visual side of your report. So within this folder and sub folders are things such as any custom visuals used in the report, the report theme, and the linguistic schema. All of which you can open to see how they are structured.

Also contained in this Report folder within the StaticResources and then RegisteredResources sub folders are any images embedded within the report. This includes any images uploaded for use within the report, but also any images uploaded for use as a page background. If we open up this folder you should see some images, if the Power BI file you unzipped has any background or other images,

Contents of Report\StaticResources\RegisteredResources

If we edit any of these images, and then rezip the file followed by renaming the file extension. Any changes we made to these images will now appear in the file as new background pages. It is important that you do not change the file names as otherwise your file will become corrupted.

Now this can be done manually for each image which if you only have one or two images is fine. However, I love an excuse to play around with PowerShell and learn something new so I have written a PowerShell script that will replace all the backgrounds of a Power BI report with a new image. It does require you to have 7zip installed as I could not get it to work using the inbuilt windows zip cmdlets.

Above: After the script
Below: Before the script

PowerShell Script

Leave a Reply

Your email address will not be published. Required fields are marked *