web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Compres quality image
Power Apps
Unanswered

Compres quality image

(0) ShareShare
ReportReport
Posted on by 70

I need Help

my function is

First(ThisItem.Attachments).Value

 i want to compres the quality of my image

Categories:
I have the same question (0)
  • Hassan_SZ_365 Profile Picture
    542 on at

    Hi @fadel13 ,

    To compress the quality of an image in Power Apps, you can use the 'Compress' function in combination with the

    'UpdateContext' function. Here's an example of how you can do it: 

     

    UpdateContext({CompressedImage: Compress(ThisItem.Attachments.Value, 0.5)})

     

    In this example:

    1. ThisItem.Attachments.Value retrieves the image from your item's attachments.

    2. Compress() function is used to compress the image. The second parameter (0.5 in this case) represents the quality of the image after compression. You can adjust this value to control the level of compression. A lower value will result in higher compression and lower image quality.

    3. UpdateContext() is used to store the compressed image in a context variable named CompressedImage. You can then use this variable to display or work with the compressed image in your Power App.

    Remember to adjust the quality value (0.5 in this example) to your desired level of image compression. Lower values will result in more compression but lower image quality, while higher values will result in less compression and better image quality. 

    Best Regards,
    Hassan Raza

     

  • fadel13 Profile Picture
    70 on at

    Here i try the function but it didn't works
    maybe you can help me @Hassan_SZ_365 

     

    fadel13_1-1699579515783.png

     

     

  • Hassan_SZ_365 Profile Picture
    542 on at

    Hi @fadel13 ,

    The initial function provided: 

     

    First(ThisItem.Attachments).Value

     

    is intended to retrieve the first attachment from an item. You want to compress the quality of this image.

    The response suggests using the following function to compress the image: 

     

    UpdateContext({CompressedImage: Compress(ThisItem.Attachments.Value, 0.5)})

     

    However, you indicates that this function did not work when they attempted to implement it.

    The issue may be arising from a couple of potential areas:

    1. Attachment Retrieval: If ThisItem.Attachments contains multiple attachments, ThisItem.Attachments.Value may not correctly retrieve the intended image. It should be First(ThisItem.Attachments).Value to ensure it's targeting the first attachment explicitly.

    2. Compress Function Syntax: If there's an error in the Compress function usage or if the function isn't supported as described in the given context. The provided syntax assumes that Compress is a valid function and accepts two parameters: the image to compress and the quality setting.

    3. Context Variable: The UpdateContext function is used to create a context variable, which is not accessible outside the screen it's created in. If the variable is being used elsewhere, it might not work as expected.

    Here’s a step-by-step approach to troubleshooting:

    • Validate the Function: Ensure that the Compress function exists and is used correctly as per Power Apps documentation. It’s possible that there is a syntax error or a misunderstanding of the function’s usage.

    • Check the Context: Confirm that the context variable CompressedImage is being used within the same screen it’s created in. Context variables are not accessible across different screens within Power Apps.

    • Debugging: Use the Label control to output the result of First(ThisItem.Attachments).Value to ensure it's retrieving the correct image data. Then, test the Compress function with hard-coded image data to confirm it works on its own.

    • Review Error Messages: If Power Apps provides error messages or codes, review them for hints on what is going wrong.

    • Power Apps Community: If the issue persists, consider reaching out to the Power Apps community forums for more tailored support, as the community may have experienced similar issues.

    If YOu provided an exact error message or more detailed description of the issue, I can offer more specific advice.

    Best Regards,
    Hassan Raza

  • fadel13 Profile Picture
    70 on at

    Sorry because i'm the new user of powerapps
    Like this. I want the displayed image to be of low quality, so when opened it doesn't need a longtime screen load @Hassan_SZ_365 

     

    Screenshot_20231110_044753.png

     

  • Hassan_SZ_365 Profile Picture
    542 on at

    Hi @fadel13 ,

    Power Apps does not natively support an operation to compress an image's quality directly within the app. Image compression typically needs to be done before the image is uploaded to the data source or with an external service or flow that handles the compression.

    However, if you're simply looking to reduce the display size of the image to improve load times within the app, you could:

    1. Adjust the Image Control: Set the ImagePosition property of the image control to Fit or Fill to ensure the image is only displayed within the bounds of the control without changing the actual file size.

    2. Use Thumbnails: If using SharePoint, create a thumbnail or lower quality version of the image to be displayed in the app while the high quality version is kept for other purposes.

    3. Power Automate: Consider creating a flow in Power Automate that triggers on image upload to compress the image and store it back to SharePoint or your chosen data source.

    Here's a suggestion to communicate to your client:

    "Power Apps does not have a built-in function to compress images within the app. If you are looking to improve load times, consider using smaller images or thumbnails. Alternatively, you can automate the compression process using Power Automate which will compress the images as they are uploaded to your data source."
    Best Regards,
    Hassan Raza

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard