Re: [Zope3-dev] image libraries implementation in zope3 ?

2006-05-26 Thread Lennart Regebro

On 5/26/06, Benji York <[EMAIL PROTECTED]> wrote:

-0, I don't quite see the need to abstract away image manipulation
libraries.


I do. There are several of them, and at least the trivial stuff like
resizing and format converting definitely can use an abstracted
interface, so that you can resize, no matter what library you use.

For more advanced stuff the abstraction seems pointless, the interface
would be to specific anyway.

But maybe it should be called IImageResizer, and IImageConverter,
instead of trying to merge those very different interfaces into one.

--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



RE: [Zope3-dev] image libraries implementation in zope3 ?

2006-05-26 Thread dev
Hi Benji

[...]
> gawel wrote:
> > image transformation is a common task for web developpers.
> > i've created a package to make them stop reinventing the wheel each 
> > time they need to resize an image or something else.
> 
> -0, I don't quite see the need to abstract away image 
> manipulation libraries.

Could be useful but we can't have it in the Zope3 core
because of it's dependency to PIL and ImageMagick.

I guess the right thing is to put it in a additional repos
like z3c.

Regards
Roger Ineichen

___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



RE: [Zope3-dev] image libraries implementation in zope3 ?

2006-05-26 Thread dev
Hi Gael, Bernd

Bernd and I added the z3c repository as a kind of
Zope3 community repository at the last swiss easter sprint.

I guess your package is a good thing to have it there.

We do not have any restriction for packages which are 
located in this repository, except that they should follow
the ZSCP standard which defines only quality aspects.

I'm interessted to put it to this location if you like.

Bernd
What do you think? Did you allready implement such a package 
for your projects. 

Regards
Roger Ineichen
_
END OF MESSAGE
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of gawel
> Sent: Friday, May 26, 2006 3:22 PM
> To: zope3-dev@zope.org
> Subject: [Zope3-dev] image libraries implementation in zope3 ?
> 
> Hi zope3 coders,
> 
> image transformation is a common task for web developpers.
> i've created a package to make them stop reinventing the 
> wheel each time they need to resize an image or something else.
> 
> this package provides an IImageTransformer adapter to adapt an IImage.
> IImageTransformer use a named IImageLibrary utility to 
> transform the image.
> i've already implemented an ImagingLibrary for PIL and an 
> ImageMagickLibrary for ImageMagick but you can implements, 
> register and then use your own IImageLibrary.
> the default IImageLibrary used by IImageTransformer is 
> configured via zcml.
> this way you don't have to take care which library is used 
> when you resize/rotate your image.
> 
> i'd realy like to see this in the zope3 core or at least in a 
> z3c/zf package.
> my package is named imagelib and is located in lib/python actualy.
> i'm sure my code isn't perfect but it's a good starting point 
> for you guys to implement this.
> 
> i don't have write access to the zope repository so if you're 
> interested in this package, i will send it to someone with 
> write access.
> 
> i join my doc test file to this email.
> 
> regards,
> 
> --
> Gael 
> 

___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] image libraries implementation in zope3 ?

2006-05-26 Thread Benji York

gawel wrote:

image transformation is a common task for web developpers.
i've created a package to make them stop reinventing the wheel each time 
they need to resize an image or something else.


-0, I don't quite see the need to abstract away image manipulation 
libraries.


i don't have write access to the zope repository so if you're interested 
in this package, i will send it to someone with write access.


You should sign a contributor agreement.
--
Benji York
Senior Software Engineer
Zope Corporation
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] image libraries implementation in zope3 ?

2006-05-26 Thread gawel
Hi zope3 coders,

image transformation is a common task for web developpers.
i've created a package to make them stop reinventing the wheel each time they need to resize an image or something else.

this package provides an IImageTransformer adapter to adapt an IImage.
IImageTransformer use a named IImageLibrary utility to transform the image.
i've already implemented an ImagingLibrary for PIL and an
ImageMagickLibrary for ImageMagick but you can implements, register and
then use your own IImageLibrary.
the default IImageLibrary used by IImageTransformer is configured via zcml.
this way you don't have to take care which library is used when you resize/rotate your image.

i'd realy like to see this in the zope3 core or at least in a z3c/zf package.
my package is named imagelib and is located in lib/python actualy.
i'm sure my code isn't perfect but it's a good starting point for you guys to implement this.

i don't have write access to the zope repository so if you're
interested in this package, i will send it to someone with write access.

i join my doc test file to this email.

regards,

--
Gael
=
Image library interface.
=

This package provides a set of utilities and adapters
to implements some image libraries (python-imaging (PIL)
and ImageMagick) functionalities.


Image is adaptable with IReadFile and IWriteFile::

  >>> from zope.configuration import xmlconfig
  >>> context = xmlconfig.string("""
  ... 
  ...   
  ... 
  ... 
  ...   
  ... 
  ... """)

We can create an Image object and use the transformer to resize it.
We don't have to take care of which image library is used::

  >>> import imagelib
  >>> from imagelib.tests import getTestImage
  >>> from imagelib.interfaces import IImageTransformer
  >>> image = getTestImage()
  >>> image.getImageSize()
  (145, 42)
  >>> transformer = IImageTransformer(image) 
  >>> transformer.resize((100,100))
  >>> size = image.getImageSize()
  >>> 100 in size
  True

We can also rotate the image::

  >>> image = getTestImage()
  >>> image.getImageSize()
  (145, 42)
  >>> transformer = IImageTransformer(image) 
  >>> transformer.rotate(90)
  >>> image.getImageSize()
  (42, 145)

We can work on a copy of the original image::

  >>> transformer2 = transformer.copy()
  >>> image is transformer.getObject()
  True
  >>> image is transformer2.getObject()
  False

ImageTransformer also implement IReadFile::

  >>> from zope.app.filerepresentation.interfaces import IReadFile
  >>> IReadFile.providedBy(transformer)
  True
  >>> image.data == transformer.read()
  True

PIL is used as default image library but
we can force which librairie is used::

  >>> image = getTestImage()
  >>> image.getImageSize()
  (145, 42)
  >>> transformer = IImageTransformer(image) 
  >>> transformer.library
  u'pil'
  >>> transformer.library = 'im'
  >>> transformer.library
  u'im'
  >>> transformer.rotate(90)
  >>> image.getImageSize()
  (42, 145)

We can also change the default library via a zcml directive::

  >>> context = xmlconfig.string("""
  ... 
  ...   
  ... 
  ... """,context)
  >>> transformer = IImageTransformer(image) 
  >>> transformer.library
  u'im'

We can't use a non-exist library::

  >>> transformer.library = 'mylib'
  Traceback (most recent call last):
  ...
  ComponentLookupError: 'No utility named mylib.'

But we can register a new library via zcml::

  >>> context = xmlconfig.string("""
  ... 
  ...   
  ... 
  ... """,context)

Now we can use it::

  >>> image = getTestImage()
  >>> transformer = IImageTransformer(image) 
  >>> transformer.library = 'mylib'
  >>> transformer.library
  u'mylib'
  >>> transformer.resize((100,100))

But, hum, our custom library don't resize anything::

  >>> image.getImageSize()
  (145, 42)
  










___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Zope 3 deprecation in 3.3

2006-05-26 Thread Martijn Faassen

Gary Poster wrote:


On May 24, 2006, at 11:56 AM, Jim Fulton wrote:


Christian Theune wrote:
...
Hooray. Now, all the moves have happened already. Does someone know 
of a good and reliable way to find all the things we broke?


Sure, release 3.3 final and wait for the reports to come in. ;)


FWIW, most or all of the packages in the collector issue's list actually 
have deprecation pointers in the trunk.  Perhaps this is a packaging issue?


Hm, indeed - Schooltool basically worked after the whole module move, 
except for a few breakages in API which I quickly fixed on the trunk. 
Given this, I'm surprised you find so many broken imports all of a sudden.


Regards,

Martijn

___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com