Page 1 of 1

TRichview to WMF or BMP Output Image Size.

Posted: Fri Apr 19, 2013 8:56 am
by siksik85
I have some questions about image randering.

When I save a Trichview output as two image files of wmf and bmp,

it is different that the size(width*height) and the space between letters of wmf from those of bmp.


How can I save the same size(width*height) of wmf and bmp?


Because I have to provide a transparent finish, I need the same size of wmf such as bmp.

I 'd appreaciate your quick response. thx.


used source and output image :
http://devsik.cafe24.com/wmf_bmp_.zip

Posted: Fri Apr 19, 2013 11:33 am
by Sergey Tkachenko
Sorry, I do not know how to define TMetafile size so that it is exactly equal to the bitmap size.
In my test, your example generates the same image for metafile and bitmap, they can be compared by placing Image on top of Image2.

However, with a minor modification (instead of assigning Image.Picture.Graphic := wmf, saving wmf to a file and loading in Image.Picture.Metafile), the result becomes completely wrong.
This situation may be saved by assigning MMWidth and MMHeight:

Code: Select all

  wmf.MMWidth := Round((Width/Screen.PixelsPerInch)*2540);
  wmf.MMHeight := Round((Height/Screen.PixelsPerInch)*2540);
This assignment must be done after freeing Canvas (but before freeing wmf; yes, Canvas should be freed before)