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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Image Compression on attaching an Image

(0) ShareShare
ReportReport
Posted on by 370

Hi,

due to some business requirements i want that, whenever an image is attached it gets compressed to a size of 60 KB or less, now what approach shall i follow.

I have tried using a plugin,on post-operation stage and create message for annotation this plugin is registered.

I retrieve the image which i am trying to insert, plugin returns me a base64String , now i need to compress this base64 which i tried doing using System.IO.Compressor but the compressed base64 does not render.

Any suggestions on this.

CompressImage-_2D00_-Microsoft-Visual-Studio--_2800_Administrator_29005F00_2017_2D00_11_2D00_29_5F00_14_2D00_57_2D00_08.png

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi,

    What type of files do you want to compress please? If this is an image, you can try to use bitmap class to resize image to lower size.

    Hope this helps

    Vlad
    http://dynamicalabs.com/

  • laiq Profile Picture
    5 on at

    Jpeg Compress allows you to compress your photos as much as possible without sacrificing quality or detail. You can even reduce their size on any device.

    https://jpegcompress.com/

  • haseem Profile Picture
    23 on at
    Consider using a library specifically designed for this task. Libraries like ImageProcessor for .NET, Pillow for Python, or other similar tools in your language of choice can be more effective. These libraries provide more control over the compression process and maintain a balance between size reduction and image quality. 
    When you convert images to a base64 string, the size usually increases by about 33%. If your requirement to keep the base64 string under 60 KB is strict, you'll need to compress the image further to account for this increase.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans