New vs Legacy 4D pictures


Prior to 4Dv11, the format of 4D picture fields and variables was the MacOS (QuickDraw) PICT, a proprietary container designed by Apple to hold uncompressed pixelmaps, compressed data, as well as vector graphics.

As Apple gradually moved towards non-proprietary formats, 4D v11 introduced a new picture format while maintaining compatibility with legacy PICTs. As a result, picture fields that crossed the v11 boundary could end up containing a mix of old and new stuff. This may become a problem when moving to v14 or later, i.e. to versions that strongly discourage use of the legacy format and its dependencies, such as QuickTime.

In the light of the above, it is recommended that you update your 4D pictures, which means, get rid of legacy PICT and make sure all pictures are in the new 4D picture format and hold standard image data such as JPEG, TIFF, PNG, etc.

This is what kind of 4D pictures are produced by various versions of 4D and QPix, past and current:

Format Picture Content 4D/QPix version 4D/QPix commands that create such pictures
Legacy (PICT) QT-compressed QuickDraw PICT Up to 4D 2004 COMPRESS PICTURE
Up to QPix 3.6x QPx_CompressPicture, QPx_ReadImageFileInPicture, etc
Uncompressed pixelmap QuickDraw PICT Up to 4D 2004 4D Write etc
Up to QPix 3.6x QPx_CompressPicture (with "none" codec), QPx_RotatePicture, QPx_ResizePicture, QPx_FilterPicture, etc
New Standard image data (JPEG, PNG, TIFF, etc) 4D v11 or later READ PICTURE FILE
QPix 3.7 or later All QPix commands that return pictures, including QPx_CompressPicture

Updating legacy 4D pictures

Starting with v11, 4D uses its new picture format for picture fields and variables. Older datafiles with pictures in the legacy (PICT) picture format, were automatically "updated", though not in a neat way. The neat way would be to extract the image data from the legacy picture, then encapsulate these data in a new container. Unfortunately, what was actually done was that the entire legacy PICT container was wrapped within a new picture container. Result: old stuff in a new package.

Therefore, it's possible for such new pictures to hold in their guts image data compressed with QuickTime, and this is a potential risk, especially on Windows: as QuickTime is gradually being bumped (optional in v14, obsolete in v15), one wonders what will happen when QuickTime is no longer there. A jpeg file may be read by just about anything, but a 4D picture containing a legacy PICT containing data compressed with the QT jpeg codec, can only be read by QuickTime. That's why proper updating of your legacy 4D pictures is a very good idea.

The enhanced role of QPx_GetCompressedPictureInfo

While fully supporting 4D's new picture format, QPix 3.7 can also identify legacy pictures and return detailed information, as well as actual image data. The command that is central to these capabilities is the new implementation of QPx_GetCompressedPictureInfo that lets you x-ray all pictures in your datafiles and decide how you can best update them for trouble-free operation of your databases.

In its new, extended form QPx_GetCompressedPictureInfo retrieves information and image data from 4D pictures in both the new and the legacy (PICT) format. A new BLOB argument has been added to receive the actual image data, which can be used to properly update legacy pictures without losing quality (in case they were compressed with a lossy method).

For detailed information and example code, check out the manual page on QPx_GetCompressedPictureInfo. Also, the QPix 3.7 demo database includes an example that lets you see how all these things work in a live database.