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) as well as the image data itself. Planned features include conversion between formats, cropping and scaling, annotating with text, and compositing of multiple images. 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 ------------------ ---------- ----------------------------------------------- image(BYTEA, TEXT) IMAGE Construct an IMAGE value from raw image data in JPEG or PNG format. Must supply the image's mimetype ("image/png" or "image/jpeg"). 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_hash(IMAGE) INT4 Hash value. = (IMAGE, IMAGE) BOOLEAN Equality. <>(IMAGE, IMAGE) BOOLEAN Inequality. Build/install ------------- To build (and install): make make install make installcheck 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.