Blog Post

Replacing Images in PBIR Format Reports

,

With the PBIR format of Power BI reports, it’s much easier to make report updates outside of Power BI Desktop. One thing you may want to do is to switch out an image in a report. Maybe you need to rebrand a report, updating some of the images (logos and background images). You could import the images or use image URLs with DAX, but that comes with its own problems. If you have some dev ops or automation skills, this becomes pretty easy.

When you insert an image into a report in Power BI Desktop, the original name of the image file is modified by adding a string of characters onto the end of the name. For a report in PBIR format, all images are placed into the <ReportName>.ReportStaticResourcesRegisteredResources folder.

Screenshot of the RegisteredResourcesFolder in a PBIR format report containing 3 images
The RegisteredResources folder containing 3 images

Replacing an image with the same name

If you have the name of the file that is in the RegisteredResources folder, you can simply replace it with a file of the same name. This assumes the dimensions and resolution of the file are the same so it looks ok in the report.

You could automate this in Azure DevOps pipelines or Github Actions, or just write a PowerShell script that checks out the branch in source control, replaces the image, and then checks it back in.

Replacing an image with a different name

If you need to replace the image file with a file that has a different name, there are more modifications to be done.

The image file name is referenced in 2 files:

  • the report.json file for the report, found in the <ReportName>.Reportdefinition folder
  • the visual.json file for the visual that contains the image, found in the <ReportName>.Reportdefinitionpages<PageName>visuals<VisualName> folder
Screenshot of the report.json folder showing the references to the 3 images from the RegisteredResources folder.
report.json file containing references to the image files

You could delete the original image, add the new image with new file name, and then update the references in those two files.

I’ve tested both ways using an Azure DevOps pipeline for automation. I added a step that runs a PowerShell script. Unless the image name is very important to you, I would just rename the new image to match the current image and avoid having to update the JSON files.

Original post (opens in new tab)
View comments in original post (opens in new tab)

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating