Skip to content

Commit 7bc38f0

Browse files
committed
Merge branch 'bhazuka-master'
2 parents 47a0553 + c721e44 commit 7bc38f0

File tree

7 files changed

+142
-12
lines changed

7 files changed

+142
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ build
55
dist
66
utils/postpic_import
77
utils/postpic_export
8+
server/sql/postpic--0.9.1.sql

server/Makefile

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
1-
# GraphicsMagick's configuration info
1+
#GraphicsMagick's configuration info
22
GMCONF = GraphicsMagick-config
33
GMFLAGS = `${GMCONF} --cppflags --cflags`
44
GMLIBS = `${GMCONF} --libs`
55

66
# info for pgxs
7-
OBJS = postpic.o
8-
MODULE_big = postpic
9-
DATA = postpic.sql
107
PG_CPPFLAGS = ${GMFLAGS}
11-
SHLIB_LINK = ${GMLIBS}
8+
SHLIB_LINK = ${GMLIBS}
9+
PG_CONFIG = pg_config
10+
11+
EXTENSION = postpic
12+
EXTVERSION = $(shell grep default_version $(EXTENSION).control | \
13+
sed -e "s/default_version[[:space:]]*=[[:space:]]*'\\([^']*\\)'/\\1/")
14+
15+
MODULES = $(patsubst %.c,%,$(wildcard src/*.c))
16+
17+
DATA = $(filter-out $(wildcard sql/*--*.sql),$(wildcard sql/*.sql))
18+
TESTS = $(wildcard test/sql/*.sql)
19+
DOCS = $(wildcard ../*.md)
20+
21+
PG91 = $(shell $(PG_CONFIG) --version | grep -qE " 8\\.| 9\\.0" && echo no || echo yes)
22+
23+
ifeq ($(PG91),yes)
24+
all: sql/$(EXTENSION)--$(EXTVERSION).sql
25+
sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql
26+
cp $< $@
27+
28+
DATA = $(wildcard sql/*--*.sql) sql/$(EXTENSION)--$(EXTVERSION).sql
29+
EXTRA_CLEAN = sql/$(EXTENSION)--$(EXTVERSION).sql
30+
endif
1231

13-
PG_CONFIG = pg_config
1432
PGXS := $(shell $(PG_CONFIG) --pgxs)
1533
include $(PGXS)

server/doc/postpic.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
PostPic: A PostgreSQL extension for image-processing
2+
====================================================
3+
4+
PostPic is an extension for the open source PostgreSQL dbms that enables
5+
image processing inside the database, like PostGIS does for spatial data.
6+
It adds the new 'image' type to the SQL, and several functions to process
7+
images and to extract their attributes.
8+
9+
Eg.
10+
11+
select * from images
12+
where date(the_img) > '2009-01-01'::date
13+
and size(the_img) > 1600;
14+
15+
Traditional relational clauses can be combined in queries with image-related
16+
ones, and basic image processing can be performed in SQL.
17+
18+
19+
Resources
20+
---------
21+
22+
PostPic is hosted at [GitHub](https://github.com/drotiro/postpic),
23+
there you can find all the code releases and the project
24+
[Wiki](http://wiki.github.com/drotiro/postpic/>)
25+
with detailed documentation about the project.
26+
27+
28+
Contents of this package
29+
------------------------
30+
31+
This package contains the following:
32+
33+
* __server__: sources for the server extension
34+
* __utils__: utilities for client-side loading of images, etc.
35+
* __examples__: a sql script to create sample tables and functions
36+
37+
38+
Copyright and license
39+
---------------------
40+
41+
PostPic is Copyright (C) 2010 Domenico Rotiroti.
42+
43+
This program is free software: you can redistribute it and/or modify
44+
it under the terms of the GNU Lesser General Public License as
45+
published by the Free Software Foundation, version 3 of the License.
46+
47+
This program is distributed in the hope that it will be useful,
48+
but WITHOUT ANY WARRANTY; without even the implied warranty of
49+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50+
GNU Lesser General Public License for more details.
51+
52+
A copy of the GNU Lesser General Public License is included in the
53+
source distribution of this software.

server/postpic.control

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
comment = 'PostPic is an extension for the open source PostgreSQL dbms that enables image processing inside the database.'
2+
default_version = '0.9.1'
3+
module_pathname = '$libdir/postpic'
4+
requires = 'plpgsql'
5+
schema = 'public'
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/* contrib/postpic/postpic--unpackaged--0.9.1.sql */
2+
3+
-- complain if script is sourced in psql rather than via CREATE EXTENSION
4+
\echo Use "CREATE EXTENSION postpic" to load this file. \quit
5+
6+
-- image Type
7+
ALTER EXTENSION postpic ADD TYPE image;
8+
ALTER EXTENSION postpic ADD FUNCTION image_in(cstring);
9+
ALTER EXTENSION postpic ADD FUNCTION image_out(image);
10+
ALTER EXTENSION postpic ADD FUNCTION image_send(image);
11+
ALTER EXTENSION postpic ADD FUNCTION image_recv(internal);
12+
13+
-- colorspace Type
14+
ALTER EXTENSION postpic ADD TYPE colorspace;
15+
16+
-- color Type
17+
ALTER EXTENSION postpic ADD TYPE color;
18+
ALTER EXTENSION postpic ADD FUNCTION color_in(cstring);
19+
ALTER EXTENSION postpic ADD FUNCTION color_out(color);
20+
21+
-- Create image functions
22+
ALTER EXTENSION postpic ADD FUNCTION image_new(INT, INT, color);
23+
ALTER EXTENSION postpic ADD FUNCTION image_from_large_object(oid);
24+
ALTER EXTENSION postpic ADD FUNCTION image_from_bytea(bytea);
25+
26+
-- Image metadata functions
27+
ALTER EXTENSION postpic ADD FUNCTION width(image);
28+
ALTER EXTENSION postpic ADD FUNCTION height(image);
29+
ALTER EXTENSION postpic ADD FUNCTION date(image);
30+
ALTER EXTENSION postpic ADD FUNCTION f_number(image);
31+
ALTER EXTENSION postpic ADD FUNCTION exposure_time(image);
32+
ALTER EXTENSION postpic ADD FUNCTION iso(image);
33+
ALTER EXTENSION postpic ADD FUNCTION focal_length(image);
34+
ALTER EXTENSION postpic ADD FUNCTION colorspace(image);
35+
ALTER EXTENSION postpic ADD FUNCTION size(image);
36+
37+
-- Image manipulation functions
38+
ALTER EXTENSION postpic ADD FUNCTION thumbnail(image, INT);
39+
ALTER EXTENSION postpic ADD FUNCTION square(image, INT);
40+
ALTER EXTENSION postpic ADD FUNCTION draw_text(image, VARCHAR);
41+
-- Image, text, x, y
42+
ALTER EXTENSION postpic ADD FUNCTION draw_text(image, VARCHAR, INT, INT);
43+
-- Image, text, x, y, font family, font size
44+
ALTER EXTENSION postpic ADD FUNCTION draw_text(image, VARCHAR, INT, INT, VARCHAR, INT);
45+
-- Image, text, x, y, font family, font size, color
46+
ALTER EXTENSION postpic ADD FUNCTION draw_text(image, VARCHAR, INT, INT, VARCHAR, INT, color);
47+
ALTER EXTENSION postpic ADD FUNCTION draw_rect(image, BOX, color);
48+
ALTER EXTENSION postpic ADD FUNCTION resize(image, INT, INT);
49+
ALTER EXTENSION postpic ADD FUNCTION crop(image, INT, INT, INT, INT);
50+
ALTER EXTENSION postpic ADD FUNCTION rotate(image, FLOAT4);
51+
ALTER EXTENSION postpic ADD FUNCTION rotate_left(image);
52+
ALTER EXTENSION postpic ADD FUNCTION rotate_right(image);
53+
ALTER EXTENSION postpic ADD FUNCTION index (image[], VARCHAR, INT);
54+
55+
-- Postpic information
56+
ALTER EXTENSION postpic ADD FUNCTION postpic_version();
57+
ALTER EXTENSION postpic ADD FUNCTION postpic_version_release();
58+
ALTER EXTENSION postpic ADD FUNCTION postpic_version_major();
59+
ALTER EXTENSION postpic ADD FUNCTION postpic_version_minor();
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/*
22
* Definition of our basic type: image
33
*/
4-
DROP TYPE image CASCADE;
54
CREATE TYPE image; -- shell type
65

76
CREATE FUNCTION image_in ( cstring )
@@ -62,11 +61,6 @@ CREATE TYPE color (
6261
internallength = 8
6362
);
6463

65-
/*
66-
* Make sure plpgsql is in
67-
*/
68-
CREATE LANGUAGE plpgsql;
69-
7064
CREATE FUNCTION image_new( INT, INT, color )
7165
RETURNS image
7266
AS '$libdir/postpic'
File renamed without changes.

0 commit comments

Comments
 (0)