Who needs compression?
Even small pictures are huge compared to other kinds of data: a typical small thumbnail occupies 20K, roughly the same as 10 pages of plain text or a 4D set for 165000 records!
Image thumbnails are usually kept inside the 4D datafile and, as we want our datafile to remain as small as possible, reducing the size of thumbnails isnt such a bad idea. In fact, the need for compression is inherent in image databases.
QuickTime does compression
QPix provides access to QuickTime compression services, which makes compressing images easy and efficient. We should let our users decide about compression, because good compression is lossy and users may not like loss of image quality in certain cases.
To let users choose a compression method, quality and color depth of the compressed thumbnail, we invoke QuickTime's compression settings dialog using the QPx_DoCodecSettingsDialog command. While choosing compression settings, the user can see how the thumbnail will eventually look like:
|
We can now compress the thumbnail and create the database record:
|
![]() |
Sometimes you may need to decompress a compressed picture. To do this, compress it with the "raw " codec (there is a space at the end of the codec name dont miss it!): $error:=QPx_CompressPicture($thumbnail;"raw ";1024;0) |