Problem with image sizes

General TRichView support forum. Please post your questions here
Post Reply
antarey
Posts: 28
Joined: Mon Dec 20, 2021 9:25 am

Problem with image sizes

Post by antarey »

Good afternoon.
I use TRichView FMX 22.2 and C++Builder 12.
I insert pictures *.png/*.jpg/*.webp
I insert the image like this:

Code: Select all

TRVGraphicFM* Graphic;
		OpenDialog->Filter = "Images|*.bmp;*.jpg;*.jpeg;*.png;*.gif;*.tif;*.tiff;*.ico;*.webp";

		if (OpenDialog->Execute()) {
			Graphic = RVGraphicHandler->LoadFromFile(OpenDialog->FileName);

			if (Graphic != NULL) {
				ActiveEditor->InsertPicture("", Graphic, rvvaAbsMiddle);
			}
        }
I am exporting to html

Code: Select all

rve->SaveHTMLToStream(HtmlText, FolderToExport + "\\", rvhtmlspMiddle);
Images are saved separately from HTML.
File sizes increase greatly. The size of png/jpg increases +- 2 times. But webp from 84k increased to 700k.
The image sizes were not changed.
I re-read the certificate and nothing is written about quality.
How to save images in original quality as is?
Thanks in advance for your help
Sergey Tkachenko
Site Admin
Posts: 17310
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Problem with image sizes

Post by Sergey Tkachenko »

TRichView for FireMonkey saves images with default parameters.
For WebP, when parameters are not specified, Skia4Delphi chooses maximum image quality, so images are saved lossless (or almost lossless), resulting large files.
In the next update, I'll add a new global variable RVDefaultImageSavingQuality in fmxRVGraphicsFM.pas:

Code: Select all

var
  // encode quality 0..100
  RVDefaultImageSavingQuality: Integer = 100;
It will be used to define saving quality for all formats that use lossy compression.
Probably, in future, I'll add SavingQuality property to image objects in TRichView documents.
Post Reply