> Hi, > If the database had built-in functions to manipulate images (make a > thumbnail, add text ont it.., make a montage of two pictures) and I could > write something like > select thumbnail(image_field, 100, 100) from images_table > that would be a good reason to go the db route versus the filesystem > route. A database does more then storing data, it makes convenient to > play with them. Once my pictures are stored in the database, how do I make > thumbnails for instance? Maybe the solution already exists; I am curious > here. Is there a way to integrate ImageMagick into a PostgreSQL workflow? > By the way, is it practical to set a bytea column (containing pictures) as > primary key? That would severely slow down many operations I guess. > JCR > > With Python and the python imaging library you can do this : image is a bytea field curs = conn.cursor () curs.execute( "select image from images where name = %s" ,(thename, )) row = curs.fetchone() if row: im = Image.open (StringIO.StringIO(row[0])) im.thumbnail (160,120 ) imagetmp = StringIO.StringIO() im.save ( imagetmp , "JPEG") print ("Content-type: image/jpeg\n\n") print ( imagetmp.getvalue()) with this you get your image to the browser thumbnailed without touch the filesystem that's all Leonel