From fredrik_lundh@ivab.se Mon Apr 1 05:58:41 1996 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Mon, 1 Apr 1996 07:58:41 +0200 Subject: [PYTHON IMAGE-SIG] image streams? In-Reply-To: <199603312359.QAA05765@anchor.cs.colorado.edu> (message from Carlos Maltzahn on Sun, 31 Mar 1996 16:59:32 -0700 (MST)) Message-ID: <9604010558.AA26088@arnold.image.ivab.se> > I wonder whether anybody is writing Python library routines for > image streams. Assuming that you mean reading and writing images directly from Python file objects, this is exactly what the PIL ImageIO interface (to be included at least to some degree in release 0.1) is all about... /F ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From fredrik_lundh@ivab.se Mon Apr 1 09:25:36 1996 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Mon, 1 Apr 1996 11:25:36 +0200 Subject: [PYTHON IMAGE-SIG] Java Imaging Library !? Message-ID: <9604010925.AA28543@arnold.image.ivab.se> A colleague just reported that Sun has released a new, really free version of Java that is as easy (if not easier) to embed and extend than even Python. In addition, they've released a really awesome image processing library, called JIL. Check "http://www.tidbits.com/issue321" for details. I'd better go look it up myself... /F (watch out for PIL 0.1 :-) ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From fredrik_lundh@ivab.se Tue Apr 2 11:55:45 1996 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Tue, 2 Apr 1996 13:55:45 +0200 Subject: [PYTHON IMAGE-SIG] Any comments on PIL 0.0? Message-ID: <9604021155.AA21935@arnold.image.ivab.se> (The silence on this list is overwhelming...) Have anyone more than Jack and David even tried out the release? Doesn't anyone have any comments, bugs, suggestions, flames??? I've added quite a few things to the library, on my way to a second release, but I do need some feedback to see if I'm still on the track. + What's missing in the library? + Can you live with the PIL/IMG marriage for a while, or should I complete the ImageIO portions before doing anything else? + Was the handbook ok? Can you handle Postscript files, or is some other format preferred? + What's needed before we can announce it to the world? (i.e. comp.lang.python) Regards /F -------------------------------------------------------------------- For latecomers, the current distribution should still be available from: http://www.python.org/sigs/image-sig/Imaging-0.0.tar.gz http://www.python.org/sigs/image-sig/Imaging-0.1-handbook-draft.ps.gz -------------------------------------------------------------------- And here's a summary of the current status. The most notable addition is the channel operations ("chops"), but the point method is not a bad one either... j = i.point(lambda a: a * 1.2) # lighten up ---------------------------- Python Imaging Library (PIL) ---------------------------- Current status (~0.08) *** Module Image class Image: "A raster image" mode -- number of bands, pixel type ["L", "RGB", "RGBA", "CMYK"] palette -- colour table, for "P" type images *NOTYET* size -- image size in pixels info -- associated data (dictionary) def convert(mode) def copy() def crop(box) def filter(kernel) def histogram() def load() def paste(image, box, [alpha]) def point(table) *NEW* def point(function) *NEW* def resize(size) def rotate(angle) def save(filename, [format]) def show() -- currently for unix only def split() def transpose(operation) def transform(size, AFFINE, matrix) def new(mode, size) def open(filename) def blend(image, image, ratio) def composite(image, image, mask) *NEW* (equivalent to copy+paste(mask)) def eval(function, images...) *NEW* (equivalent to point(function)) def merge(mode, bands) *RENAMED* *** Module ImageChops (*BETTER NAME NEEDED!*) def constant(image, value) *NEW* def duplicate(image) *NEW* def invert(image) *NEW* def lighter(image1, image2) *NEW* def darker(image1, image2) *NEW* def difference(image1, image2) *NEW* def multiply(image1, image2) *NEW* def screen(image1, image2) *NEW* def add(image1, image2, [scale, offset]) *NEW* def subtract(image1, image2, [scale, offset]) *NEW* def blend(image1, image2, alpha) def composite(image1, image2, mask) (Note that for full math support, you should use the Numerical Python extension instead. An interface will be provided later!) *** Module ImageEnhance class Color class Contrast class Brightness class Sharpness *** Module ImageFile class ImageFile(Image): "A raster image read from file or stream" def load(file) class XxxImageFile(ImageFile): "Read/write XXX file" (see below) *** Module ImageFilter class ImageFilter(): "Represents an environment filtering operation" class ImageSimpleKernel(ImageFilter): "Simple 3x3 and 5x5 integer convolutions" *** Module ImageISOFilter ~20 standard impulse filters from ISO 12087-2 *** Module ImagePalette class ImagePalette(): "A colour lookup table for palette images" mode palette def negative() def random() def wedge() *** File format support format supported operations ------ -------------------- BMP open/read/write *NOTYET* EPS open (1) FLI (FLC) open (1) GBR open/read *NOTYET* GIF open/read *IMG* JPEG (JFIF) open/read/write (3) *IMG* MSP open (1) PBM (PGM/PPM) open/read/write PCX open/read *NOTYET* PSD open (1) *NOTYET* SGI read *IMG* TIFF open/read (2) *IMG* (1) file is identified (mode, size, info), but not decoded. (2) restricted, not full baseline support. (3) requires IJG JPEG support library (libjpeg) ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From fredrik_lundh@ivab.se Tue Apr 2 12:00:10 1996 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Tue, 2 Apr 1996 14:00:10 +0200 Subject: [PYTHON IMAGE-SIG] Any comments on PIL 0.0? Message-ID: <9604021200.AA16177@arnold.image.ivab.se> And yes, Aaron Watters wondered if anyone could present the PIL on the Python conference. I'm writing some papers on PIL and our Python based remote sensing application, but I cannot attend the conference myself. If someone's able to do some nice PIL slides and talk about them a little on the conference, drop me a line. /F ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From fredrik_lundh@ivab.se Tue Apr 2 21:07:12 1996 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Tue, 2 Apr 1996 23:07:12 +0200 Subject: [PYTHON IMAGE-SIG] Going multimedia? Message-ID: <9604022107.AA32320@arnold.image.ivab.se> David Ascher wrote: > Any plans for real animation a la MPEG, etc? Does anyone here know if there are any good MPEG libraries out there? (the few programs I've looked at were tightly integrated with a viewer) /F ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From fredrik_lundh@ivab.se Wed Apr 3 11:25:19 1996 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Wed, 3 Apr 1996 13:25:19 +0200 Subject: [PYTHON IMAGE-SIG] ANNOUNCE: A minimal Matrix<->PIL interface Message-ID: <9604031125.AA20167@arnold.image.ivab.se> If someone would like to fool around with the Python Imaging Library and the Numerical extension at the same time, here's a really minimal interface between these two libraries. A little more checking should of course be added, to make sure that the image isn't multiband, and that the array really contains unsigned 8-bit integers, but at least you'll get the idea :-) /F -------------------------------------------------------------------- import Image, Numeric def ImageToArray(i): a = Numeric.array(i._tostring(), "b") a.shape = i.size[1], i.size[0] return a def ArrayToImage(a): i = Image.new("L", (a.shape[1], a.shape[0])) i._fromstring(a.toString()) return i # "If you cannot do it in 8 lines of Python, it is probably # not worth doing." -------------------------------------------------------------------- The current PIL distribution can be found at: http://www.python.org/sigs/image-sig/Imaging-0.0.tar.gz http://www.python.org/sigs/image-sig/Imaging-0.1-handbook-draft.ps.gz Release 0.1 of the library will be available real soon now (it would be nice if at least someone had any comments on the current release, though :-) ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From fredrik_lundh@ivab.se Wed Apr 17 22:55:57 1996 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Wed, 17 Apr 1996 23:55:57 +0200 Subject: [PYTHON IMAGE-SIG] Grail + PIL = true! Message-ID: <9604172155.AA20760@arnold.image.ivab.se> Grail 0.3 and PIL 0.1 now runs happily together. Well, almost, since the filetype plugins is used only when explicitly entering an URL, not for inline images and followed links :-( Hopefully, that will be fixed in time for the official release of PIL 0.1 (which will be released sometimes next week). /F -------------------------------------------------------------------- # $Id$ # # The Python Imaging Library. # # File: # pil_interface.py -- a PIL interface for Grail # # History: # 96-04-18 fl Created # import Image, ImageTk import Tkinter, StringIO from formatter import AS_IS class pil_interface: """Parser base class for images handled by PIL. This version collects all data into a string buffer, and create an image from it when completed. Things to do: - decode data as it arrives - support transparency (background colour, at least) - use progressive display """ def __init__(self, viewer, reload=0): self.broken = 0 self.viewer = viewer self.viewer.new_font((AS_IS, AS_IS, AS_IS, 1)) self.label = Tkinter.Label(self.viewer.text, text = "") self.viewer.add_subwindow(self.label) self.buf = "" def feed(self, data): try: self.buf = self.buf + data # FIXME: try to identify the file; as soon as this succeeds, # started decoding data as it arrives except IOError, (errno, errmsg): self.buf = None self.broken = 1 raise IOError, (errno, errmsg) def close(self): if self.buf: try: im = Image.open(StringIO.StringIO(self.buf)) tkim = ImageTk.PhotoImage(im.mode, im.size) tkim.paste(im) self.label.image = tkim.image self.label.config(image = self.label.image) except: self.broken = 1 if self.broken: self.label.image = Tkinter.PhotoImage(file = 'icons/sadsmiley.gif') self.label.config(image = self.label.image) self.viewer.text.insert(END, '\nBroken Image!') -------------------------------------------------------------------- And in the filetypes directory, a lot of files like: -------------------------------------------------------------------- # File: image_XXX.py import pil_interface class parse_image_XXX(pil_interface.pil_interface): pass -------------------------------------------------------------------- where XXX is one of bmp, gif, jpeg, pbm, pcx, pgm, ppm, tga, tiff, sgi, xbm (and possibly more). ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org =================