How to tell the difference between the original .BMP/.EMF picture file with the processed .BMP/.EMF file?
Summarization:
Calculations point out in a straight-forward way that: A .BMP picture of 3289 X 4570 X 32bpp takes about 53MB. The picture of same size but 24bpp takes about 43MB, that of 16bpp takes about 28MB. ChemDraw-processed picture file must then be converted from 24bpp to 16bpp in my situation.
Further comparison of the hex data of both files gives more detailed understanding of the difference between ChemDraw-processed picture and the original picture. Specifically, ChemDraw stores "EMF_STRETCHDIBITS" instead of "EMF_STRETCHBLT". It should be added that "EMF_STRETCHDIBITS" can be done by calling StretchDIBits when copying pixels into TMetaFile/TMetaFileCanvas. It should be also noted that pixels for "EMF_STRETCHDIBITS" should be the same as those for "EMF_STRETCHBLT".
Unfortunately, till now I didn't find out how ChemDraw exactly processes and stores pasted pictures. That is to say, I didn't find out why the pixels ChemDraw stored is different from what I can obtain programingly.
PS: I will vote up kind answers regarding this question later because I do not have enough reputation for the moment. Thanks for everybody who has been kind to comment!
===
Hi,
Thanks for your time very much!
Say that I have a picture named "sample_original.bmp". The file size is 3289 X 4570, 43MB. Then I do the following to convert it into a .EMF file (Enhanced Windows MetaFile):
Method 1, by making a small in-house Delphi program: (1) Load the .BMP image file. (2) Obtain the Canvas of TMetaFile(TMetaFileCanvas) (3) Call Canvas.Draw to copy the image. (4) Save to .EMF file, named "sample_original_bmp2emf_method1.emf"
Method 2: (1) Open the .BMP image file in the mspaint program, choose "select all", and choose "copy&qu开发者_运维百科ot;. (2) Open an external program called ChemDraw, create new document, and choose "paste". (3) Then I choose to save that in the XML-compatible .cdxml format, named "sample_original_bmp2emf_method2.cdxml". (4) The content of picture (maybe changed or degraded?) is now saved in the sample_original_bmp2emf_method2.cdxml file. The format is Base64-encoded zlib-compressed format. (5) I can Base64-decode the XML string, zlib-decompress it, and save it into the picture file "sample_original_bmp2emf_method2.emf".
The file size of sample_original_bmp2emf_method2.emf is smaller by 15 MB than sample_original_bmp2emf_method1.emf, but the width & height has been maintained. Furthermore, if I open "sample_original_bmp2emf_method2.emf" in the mspaint program and save it back into .bmp file format, a warning pops up that transparent information is losing.
Could you help to comment on how to tell the difference "sample_original_bmp2emf_method1.emf" & "sample_original_bmp2emf_method2.emf"? Is the picture smaller because its quality is decreased? In other words, what changes to my original picture could possibly be made by this external program?
Best wishes,
The files mentioned above can be downloaded in the following url:
http://www.rapidspread.com/file.jsp?id=2ighvzoci8
PS: I believe that Andreas Rejbrand has be kind enough to made his answer and I then gave my comments. But I cannot see those now. Is it supposed to be normal behavior of the system? o_o
You wrote:
Base64-decode the XML string, zlib-decompress it, and save it into the picture file "sample_original_bmp2emf_method2.emf".
So it's definitively NOT an emf file, but some zipped format.. Or it was converted to another format (like vectorial) before converting to XML. In this case, you've less data in the resulting picture than a real bitmap.
Whereas the first method will give you an emf file with a size of only a few bytes bigger than a plain bmp file (i.e. the emf records used to encapsulate the bitmap data).
If you zip the emf file of the first method, I'm quite sure you'll get a file with a smaller size than the false emf obtained by method two.
Why don't you just compare the two images? Open them in a raster editing program and compare the pixels.
Why do you care how big the files are? Surely what's important is whether or not the image is the right one.
精彩评论