I can't get the compression of pasted bitmaps to work. I have defined COMPRESSBITMAPASJPEG in the project and in WPInc, but the file size is still not reduced when I save a document with pasted images.
5.17.4, D7.
I can't get the compression of pasted bitmaps to work. I have defined COMPRESSBITMAPASJPEG in the project and in WPInc, but the file size is still not reduced when I save a document with pasted images.
5.17.4, D7.
Did you du a BUILDALL with the project ?
And - it will not compress images which are already in the text.
I did a buildall, and I know that only images which are pasted after the new build are supposed to be compressed. Nevertheless when I copy a 100 kB image from the web, paste it and save, the result is a rtf-file of almost 2000 kB.
I have mailed you a small demo.
Hi,
I suggest to open the unit WPObj_Image.pas, go to procedure Compress, place a breakpoint and paste the image.
Only so we can now what is really happening. The image can only be compressed if it is a TBitmap, if it is a TMetafile it wont be compressed.
Julian Ziersch
I did both place a breakpoint and a showmessage at the very start of the Compress procedure, and it was never called after pasting an image.
And, an image copied from a web page, IS a bitmap, isn't it?
Seems that
TextObject.ObjRef.Compress
in the OnPrepareImageForSaving event does the trick.
But that should not be necessary if COMPRESSBITMAPASJPEG is defined in the project, should it?
Hi,
The compress method is called in WPCtrMemo, procedure PasteFromClipboard.
if obj.IsImage then
obj.ObjRef.Compress;
Of course the event OnPrepareImageForSaving is a perfect place to call it, too - or to create files to be used by the HTML export.
The COMPRESSBITMAPASJPEG simply activates the extendable functionality of Compress in unit WPObj_Image.pas - in many cases it would make sense to create PNG or maybe also compress EMF data. But I didn't implement that.
Julian Ziersch