WPCubed Product Support

COMPRESSBITMAPASJPEG

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.

#1 ♥ 0
7.1k Views 2 users read 2 min
support

Did you du a BUILDALL with the project ?

And - it will not compress images which are already in the text.

#2 ♥ 0

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.

#3 ♥ 0
support

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

#4 ♥ 0

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?

#5 ♥ 0

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?

#6 ♥ 0
support

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

#7 ♥ 0
This category is archived. No new posts are possible.