pg_image -------- This extension provides an IMAGE datatype for the storage of bitmap images, which verifies that the image data is in a recognized format (PNG or JPEG) and provides accessor functions for the image metadata (format, width, height) and any EXIF metadata which is present. The text representation is compatible with BYTEA columns; an optional binary format is also available which allows for a compact representation. Depends on the GD library for image loading and manipulation. Usage ----- The IMAGE datatype can be added to a database using the Postgres extension mechanism: CREATE EXTENSION pg_image; Once installed, the pg_image extension provides the IMAGE datatype. The type I/O functions use the data: URI format (commonly used to include inline images in HTML and CSS documents) for the image data. Several functions and operators are provided for working with values of type IMAGE: Function/Operator Returns Description ----------------- --------- ----------------------------------------------- width(IMAGE) INTEGER Width (in pixels) of the image. height(IMAGE) INTEGER Height (in pixels) of the image. filesize(IMAGE) INTEGER File size (in bytes) of the image. mimetype(IMAGE) TEXT Image's mimetype ("image/png" or "image/jpeg"). imagedata(IMAGE) BYTEA The raw image data, in JPEG or PNG format. image(BYTEA) IMAGE Construct an IMAGE value from raw image data in JPEG or PNG format. (TODO!) image_hash(IMAGE) INT4 Hash value. = (IMAGE, IMAGE) BOOLEAN Equality. <>(IMAGE, IMAGE) BOOLEAN Inequality. Build/install ------------- To build (and install): make make install make installcheck To build the .deb package: dpkg-buildpackage -b -uc -rfakeroot Authors and Credits ------------------- Andrew Tipton andrew@kiwidrew.com The base64 encoding/decoding functions are lightly modified copies of the excellent Postgres functions by the same name. (Which are unfortunately not exposed in the public API except through a high-level wrapper.) Thanks to malloc() labs limited (www.malloclabs.com) for supporting the development of this module. License ------- This Postgres extension is free software; you may use it under the same terms as Postgres itself.