Page 1 of 1

Problem with image sizes

Posted: Tue Mar 12, 2024 8:22 am
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

Re: Problem with image sizes

Posted: Tue Mar 12, 2024 3:53 pm
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.