image processing in D

Fawzi Mohamed fawzi at gmx.ch
Sun Apr 3 05:25:10 PDT 2011


On 2-apr-11, at 10:40, aman bansal wrote:

> i was trying to chalk out a strategy to go for image processing in  
> D.the closest reference i found was in the implementation of python  
> imaging library.it has modules for imaging,and input output of jpeg  
> and bmp file formats.the data structures used also are quite  
> accurate.i would like to ask developers what can be the possible  
> problems in implementing image i/o in D on the lines of python  
> imaging library.

As I told you via email

there are two main things, one is reading/writing several formats, I  
would say that you should support at least one standard (simple)  
format natively (the simplest would be netpbm format) but then you  
could rely on libraries to support more.
Use of external libraries should be discussed with others also,  
because one should rely only on libraries that are widely available,  
cross-platform and with acceptable licensing.

About the image processing itself you probably want to have a simple  
flat representation of the image (as 2d array), and then be able to  
apply several operations on it.
General convolution is probably something you want to have, masked  
operation might also be very useful.
Not sure about which other operations you want to support.
In D1 as part of blip I have implemented nearest neighbor convolution,  
it could be useful to you.

Not sure which bit depth you want to support, one can build a wrapper  
to access arbitrary bit depth/bitchannel contiguous block of memory as  
1d or 2d array (for example 4channel 12 bit images), this can be  
useful as base type for operations with images that might have an  
extended bit range.

is this for a GSoC project?

anyway about Python Image Library, I think that the high level  
functionality is mostly ok, and probably you can lift some of the C  
part, but lots seems to be a bit python connection specific, not sure  
that it is worth using.
PIL has a BSD style licensing, this might be an issue if you want to  
have it in phobos (Boost).

PIL uses the following libraries:

    JPEG support         libjpeg (6a or 6b)
                         http://www.ijg.org
                         http://www.ijg.org/files/jpegsrc.v6b.tar.gz
                         ftp://ftp.uu.net/graphics/jpeg/

    PNG support          zlib (1.2.3 or later is recommended)
                         http://www.gzip.org/zlib/

    OpenType/TrueType    freetype2 (2.3.9 or later is recommended)
    support
                         http://www.freetype.org
                         http://freetype.sourceforge.net

    CMS support          littleCMS (1.1.5 or later is recommended)
    support
                         http://www.littlecms.com/

They seem reasonable, so the first step would be to wrap their C  
interface (if not already available, like zlib).
I thought there were some image processing projects in D1, but I  
haven't found them just now.
Still also these libraries licensing, and support should be checked,  
and evaluated also by others.

Fawzi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20110403/5a79aa48/attachment.html>


More information about the Digitalmars-d mailing list