InsertGraphicDialog image compression

  • Hello,

    I'm using InsertGraphicDialog and I would like to know if there is a way to compress image size during the insertion ?

    For instance if I'm inserting a very big JPG file, I would like to reduce its size to fit the page width and to compress the picture so it takes less space in the database.

    In the released notes it is mentionned that "TWPOCustomImage.CompressEx can now resample images", but I couldn't make it work properly.

    Thank you for your help !

    • Offizieller Beitrag

    What you are looking for is not a method to compress but to resample - you need to reduce the resolution of an image.

    You can of course take the original code of InsertGraphicDialog and add code to resample. You can create a smaller TBitmap, stretchdraw the larger JPEG on it, convert the TBitmap to a JPEG and insert.

  • Thanks for your answer, as you suggest I took the source code of InsertGraphicDialog and I used another graphic component to resample the image before inserting it on the WPRichText.
    It is working fine now. Thank you !