Page 1 of 1

How to exctact original images?

Posted: Mon Sep 15, 2014 2:35 pm
by Darken
Hello Sergey!

How to exctact original images from RichViewEdit?
I have proble with jpeg image, very loss image quality...

(Возможно существует способ извлечения оригинального изображения, в изначальном виде? Сейчас выходит что при сохранении в ХТМЛ формат, а потом обратной загрузке в RichViewEdit за несколько раз очень сильно теряется качество изображения)

javascript:emoticon(':roll:')

Code: Select all

SaveImage2
var
   gr: TGraphic;
begin
  if SaveFormat <> rvsfHTML
   then exit;

  gr := Graphic;

  Location := Format(ImagePrefix + '%d.%s', [ImageSaveNo, GraphicExtension(TGraphicClass(gr.ClassType))]);
  inc(ImageSaveNo);

  gr.SaveToFile(ImgWriteDir + '\' + Location);

  DoDefault := False;

  if gr<>Graphic then
    gr.Free;


Thank You Sergey!

Заранее спасибо!

Posted: Mon Sep 15, 2014 3:35 pm
by Sergey Tkachenko
Jpeg encoding always lose information, so each time you load and save it you lose some information.
TRichView does not store original data for images.

If the image is TJpegImage, you can assign CompressionQuality.

Posted: Mon Sep 15, 2014 8:09 pm
by Darken
Thank you Sergey for quick answear and new question.

How to get original image file name? (if exist this possibility)

Posted: Tue Sep 16, 2014 7:01 am
by Sergey Tkachenko
There is a special property for storing file names (or Internet addresses) of images, rvespImageFileName, see http://www.trichview.com/help/idh_type_ ... perty.html

However, this property may be filled or may be not.
When you paste a bitmap or a metafile from the clipboard, or load RTF with embedded images, this field cannot be filled, because these images do not have file names.
When you paste graphic files (for example, copied from Explorer), image file names are not stored as well. You can implement a special paste command calling PasteGraphicFiles(False, True) to store them.
RTF files may contain reference to external pictures. Their file names may be stored, if you assign rv.RTFReadProperties.StoreImagesFileNames = True
If you use RichViewActions, some actions may assign this property. Change
rvActionInsertPicture.StoreFileName = rvActionPasteSpecial.StoreFileName = rvActionItemProperties.StoreFileName = True

If you insert the picture yourself, you need to assign this property yourself.

Posted: Fri Oct 10, 2014 8:32 am
by Darken
TRichViewEdit can save original image in jpeg, png etc. in original quality (as HTML with image).

I'm used Envision editor, thats editor have TDibGraphic (that's override original class).

When

Code: Select all

TPicture.UnregisterGraphicClass(TDibGraphic);

everything was working!

(так как TDibGraphic подгружался и перекрывал, происходило перезжатие Jpeg и пересохраниение других форматов, что вело к потери качества изображений)

Maybe someone will be useful :roll: