How to exctact original images?

General TRichView support forum. Please post your questions here
Post Reply
Darken
Posts: 11
Joined: Tue Jul 22, 2014 1:30 pm

How to exctact original images?

Post 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!

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

Sergey Tkachenko
Site Admin
Posts: 15439
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.

Darken
Posts: 11
Joined: Tue Jul 22, 2014 1:30 pm

Post by Darken »

Thank you Sergey for quick answear and new question.

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

Sergey Tkachenko
Site Admin
Posts: 15439
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.

Darken
Posts: 11
Joined: Tue Jul 22, 2014 1:30 pm

Post 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:

Post Reply