How to adjust the size of image item in SharePoint list column?

47749506 0 Reputation points
2024-07-16T09:53:58.5566667+00:00

How can I change the size of the image item stored in a SharePoint list which gets data from Power Apps Image control in different sizes such as 1.5-15 MB? It would be great to automatically convert into 1.5MB or below keeping initial proportions of the image.

I have already tried formatting the column storing these images:

{  
  "elmType": "div",  
  "children": [  
    {  
      "elmType": "img",  
      "attributes": {  
        "src": "@currentField",  
        "title": "=if(@currentField == '', 'No picture available', @currentField)"  
      },  
      "style": {  
        "position": "relative",  
        "top": "50%",  
        "left": "50%",  
        "width": "200px",  
        "height": "200px",  
        "margin-left": "-50%",  
        "margin-top": "0%"  
      }  
    }  
  ]  
}

However, it did not work. I am trying to do so because I am using in Power Apps the image in base64 format when building HTML body. The app finds base64 image encoded from sharepoint image item of 10 MB size too heavy.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,264 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,805 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Emily Du-MSFT 44,146 Reputation points Microsoft Vendor
    2024-07-17T07:36:58.0166667+00:00

    JSON formatting customizes how fields in the SharePoint lists and libraries are displayed. The column JSON formatting doesn't change the data in the list item, it only changes how it’s displayed to users who browse the list.

    So, there is no way to adjust the size of image through JSON formatting.

    As a workaround, you could use flow to reduce image size.

    https://powerusers.microsoft.com/t5/General-Power-Automate/Flow-to-reduce-image-size/td-p/2440883


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.