Oracle8 Image Cartridge User's Guide
Release 8.0.4






Prev Next


Oracle8 Image Cartridge is an extension to Oracle8 Enterprise Edition and provides image storage, retrieval, and format conversion capabilities through an object data type (ODT). This cartridge supports image storage using binary large objects (BLOBs) and references to image data residing in external files (BFILEs).

Image Cartridge is a building block for various imaging applications rather than being an end-user application in itself. It consists of ODTs along with related methods for managing and processing image data. Some example applications for this cartridge are:

These applications have certain distinct requirements and some things in common. The purpose of the image ODTs is to support both. With Image Cartridge, images can be managed as easily as standard attribute data.

Image Cartridge provides the foundation for static, two-dimensional images in Oracle databases. The images may be bitonal (black and white) document images, gray-scale photographs, or three-color photographs. The cartridge provides the means to add image columns to existing tables, insert and retrieve images, and convert between popular application formats. The cartridge also provides sufficient capabilities for extending existing application databases with images or building new end-user image database applications.

1.1 Image Concepts

This section contains information about digital images and using Image Cartridge to build either image applications or specialized image data cartridges.

1.1.1 Digital Images

Image Cartridge provides the mechanism to integrate the storage and retrieval of digital images in Oracle databases via the Oracle8 Server.

Image Cartridge supports two-dimensional, static, digital images stored as binary representations of real world objects or scenes. Images may be produced by a document or photograph scanner, a video source such as a camera or VCR connected to a video digitizer or frame grabber, other specialized image capture devices, or even by program algorithms. Capture devices take an analog or continuous signal such as the light that falls onto the film in a camera, and convert it into digital values on a two-dimensional grid of data points known as pixels. Devices involved in the capture and display of images are under application control.

1.1.2 Image Components

A digital image consists of attributes that describe the characteristics of the image, and the image data itself (the digitized bits). Occasionally, image applications will associate application-specific information with an image, such as including the name of the person pictured in a photograph.

The minimal attributes of an image may include such things as its size (height in scan lines and width in pixels), the resolution at which it was sampled, and the number of bits per pixel in each of the colors sampled.

The image data (pixels) can have varying depths (bits per pixel) depending on how the image was captured, and can be organized in various ways. The organization of the image data is known as the data format. Image Cartridge can read and write image data using a variety of the data formats in use today. See Appendix A, "File and Compression Formats" for a list of supported data formats.

The storage space required for digital images can be large compared to traditional attribute data such as numbers and text. Many compression schemes are available to squeeze an image into fewer bytes, thus reducing storage device and network load. Lossless compression schemes squeeze an image so that when it is decompressed, the resulting image is bit-for-bit identical with the original. Lossy compression schemes do not result in an identical image when decompressed, but rather, one in which the changes may be imperceptible to the human eye.

1.1.3 Interchange Formats

Image interchange format describes a well-defined organization and use of image attributes, data, and often compression schemes, allowing different applications to create, exchange, and use images. Interchange formats are often stored in or as disk files. They may also be exchanged in a sequential fashion over a network and be referred to as a protocol. There are many application subdomains within the digital imaging world and many applications that create or utilize digital images within these. Image Cartridge supports many interchange formats (see Appendix A, "File and Compression Formats").

1.1.4 Data Cartridges

Within Oracle Corporation's Network Computing Architecture, data cartridges facilitate the storage and retrieval of complex data types required by nontraditional database applications such as geographic information systems, imaging, workflow, document management, and digital libraries. These applications are built using components or modules that support the capture, input, processing, analysis, storage, retrieval, and display of the complex data types.

A data cartridge is the mechanism by which clients, application-specific servers, and database servers can be easily and reliably extended. Image Cartridge plugs into Oracle® Universal Server and provides support for image domain-specific types, methods, and interfaces. Image Cartridge focuses on a set of image data representation and access mechanisms sufficient to support many image applications, and the development of more specialized image cartridges.

The primary focus of Image Cartridge is to provide storage, retrieval, reformatting, compression, decompression, and a minimal set of data manipulation services including scaling and cropping.

1.2 Object Relational Technology

Oracle Universal Server is an object relational database management system. This means that in addition to its traditional role in the safe and efficient management of relational data, it now provides support for the definition of object types including the data stored in an object and the operations (methods) that can be performed on that object. This mechanism, combined with integral support for binary large objects (BLOBs), provides the basis for adding complex objects such as digital images to Oracle databases.

1.2.1 Storing Images

Image Cartridge is capable of storing digital images within the Oracle database under transactional control through the BLOB mechanism. It is also capable of externally referencing digital images stored in flat files. While this later mechanism is particularly convenient for integrating pre-existing sets of flat file images with an Oracle database, these images will not be under transactional control. BLOB stored images have an object relational type known as ORDImgB, while BFILE stored images have an object relational type known as ORDImgF.

BLOBs are stored in the database tablespaces in a way that optimizes space and provides efficient access. BLOBs may or may not stored inline with other row data. Depending on the size of the BLOB, a locator is stored in the row and the actual BLOB (up to 4 gigabytes) is may be stored in other tablespace. The locator can be considered a pointer to the actual location of the BLOB value. When you select a BLOB, you are selecting the locator instead of the value, although this is done transparently. An advantage of this design is that multiple BLOB locators can exist in a single row. For example, you might want to store both an employee's photograph and his or her thumbprint or retina scan for security purposes.

BFILEs are not under the database's transactional control. Only the locator for a BFILE image is stored in the row. See the Oracle8 Application Developer's Guide and the Programmer's Guide to the Oracle Call Interface for detailed information on using BLOBs and BFILEs.

1.2.2 Querying Images

Once stored within an Oracle database, an image can be queried and retrieved by finding a row in a table that contains the image using the various alphanumeric columns (attributes) of the table. An example would be, selecting a photo from the EMPLOYEE table where the employee name is Jane Doe.

The collection of digital images in the database must be related to some set of attributes or keywords that describe the associated content. The image content can be described with textual components and numeric attributes such as dates and identification numbers. For Oracle8, image attributes reside in the same table as the image BLOB. Alternatively, an application designer could define a composite ODT that contains one of the cartridge data types along with other attributes. In subsequent releases, other schemes for handling additional attributes of image data, such as inheritance, may be available.

In collaboration with Virage, a third-party partner, Oracle offers a content-based image retrieval data cartridge based on the Virage VIR engine. This cartridge allows you to compare images based on the following set of image attributes: global color, local color, texture, and structure.

1.2.3 Accessing Images

Applications access and manipulate images using SQL or PL/SQL through the object relational image types ORDimgB and ORDimgF. The object syntax for accessing attributes within a complex object such as an image is the dot notation:


The syntax for invoking methods of a complex object such as an image is also the dot notation:

variable.function(parameter1, parameter2, ...)

A special case exists when using the SELECT, UPDATE, and DELETE statements. You must use a table alias, as follows:

SELECT table_alias.column_name.data_attribute FROM table_name table_alias

See the Oracle8 Concepts manual for information on this and other SQL syntax.

1.3 Image Methods and Operations

Image Cartridge provides methods for extracting image properties, performing image manipulations including format conversion, compression, and data manipulation operations, and copying images. This section presents a conceptual overview of these features. See Chapter 3, "Image Object Types and Procedures" for the syntax of these methods.

1.3.1 Image Property Extraction

The setProperties( ) method is used to extract important properties from image data including file format (such as TIFF, or BMP), content format (monochrome, 8-bit gray scale), height and width in pixels, compression format (JPEG, LZW), and total size in bytes.

This method should be used any time an image is stored in the database, so that the properties are always up to date. For example, the storage size for an image may be machine dependent. Therefore, exporting and then importing an image between systems may require a call to the setProperties( ) method to determine the current properties.

1.3.2 Image Manipulation

The process( ) and processCopy( ) methods are used for image format conversion, compression, and basic manipulation functions including scaling and cropping.

The image may be compressed using an algorithm from the set of supported compression schemes. For example, image data in the TIFF format may be compressed using Packbits, Huffman, JPEG, LZW, or one of the other supported compression schemes. Appendix A, "File and Compression Formats" lists the supported image formats and related compression schemes.

The output of any image manipulation function must be directed to a BLOB. In-place image manipulations of BFILEs is not supported in this release.

1.3.3 Image Copy

The copyContent( ) method is used to copy an image to a new BLOB. The method performs copies to BLOBs using the image content as the source, and a supplied BLOB as the destination. The supplied BLOB must be selected for update.

After copying the image, use the setProperties( ) method to record the attributes of the new image.


Copyright © 1997 Oracle Corporation.

All Rights Reserved.