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.
Recent activity
Commits by Andrew Tipton were pushed to malloclabs/pg_image
14e4dd4
-
Added tag 0.2_fixedMETA for changeset 1d2579a469ed
1d2579a
-
(grr, forgot to bump the version in META.json too.)
b7a0393
-
Added tag 0.2 for changeset a88dd21c97fc
a88dd21
-
oops, forgot to bump the version of the extension .sql files in the Makefile.
7a1f742
-
Added tag 0.2 for changeset c37a45c55e91
c37a45c
-
add a constructor to build an image from a BYTEA value and an image mimetype.
f15dd43
-
Added tag 0.1 for changeset f607e308d14c
f607e30
-
fix the "provides" key in the PGXN metadata.
117f77b
-
fix some trailing commas in the PGXN metadata.
a2f9da0
-
add some brief documentation and a META.json file for PGXN