This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 93fe2dde68b7eb9a2d22c4006e5c9d03c4e2485c (commit) via 5f991644977d8e9bda991e1b79efba06fc05adff (commit) via 057139e9ba8617156f214005b143846b6110f28d (commit) from f075f1935eff2f786cc3b481d1ec7037f6654a9a (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/93fe2dde68b7eb9a2d22c4006e5c9d03c4e24...
commit 93fe2dde68b7eb9a2d22c4006e5c9d03c4e2485c Author: Cyril Hrubis metan@ucw.cz Date: Fri Apr 19 18:24:13 2013 +0200
doc: update python loaders docs.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/doc/loaders_python.txt b/doc/loaders_python.txt index 4ac158b..992cd07 100644 --- a/doc/loaders_python.txt +++ b/doc/loaders_python.txt @@ -16,6 +16,12 @@ import gfxprim.loaders as loaders
Loads an image from a file.
+This is a general purpose loader function that automatically detects the file +format. + +The format is detected from file extension first and if this fails signature +base method is used. + May raise 'OSError' with errno set to 'EPERM', 'EISDIR', 'ENOENT' or any other 'errno' set by 'open(2)', 'read(2)', 'seek(2)'.
@@ -26,3 +32,42 @@ May raise 'OSError' with errno set to 'EIO' when file is damaged.
May raise 'OSError' with errno set to 'ECANCELED' when action was interrupted by callback. + + +[source,python] +------------------------------------------------------------------------------- +import gfxprim.loaders as loaders + + img.loaders.Save(path, callback=None) + + img.loaders.SavePNG(path, callback=None) + + img.loaders.SaveJPG(path, callback=None) + + img.loaders.SaveBMP(path, callback=None) +------------------------------------------------------------------------------- + +Save image to a file. + +For the Save() method the file format is derived from the extension. + +May raise 'OSError' with errno set to 'EPERM', 'EISDIR', 'ENOENT' or any other +'errno' set by 'open(2)', 'write(2)', 'seek(2)'. + +May raise 'OSError' with errno set to 'ENOSYS' on unsupported pixel type for +a given format. + +May raise 'OSError' with errno set to 'EIO' when file is damaged. + +May raise 'OSError' with errno set to 'ECANCELED' when action was interrupted +by callback. + +[source,python] +------------------------------------------------------------------------------- +import gfxprim.loaders as loaders + + loaders.ListLoaders() + +------------------------------------------------------------------------------- + +Prints all loaders and their capabilites into the 'stdout'.
http://repo.or.cz/w/gfxprim.git/commit/5f991644977d8e9bda991e1b79efba06fc05a...
commit 5f991644977d8e9bda991e1b79efba06fc05adff Author: Cyril Hrubis metan@ucw.cz Date: Fri Apr 19 18:20:57 2013 +0200
demos: py_simple: Make use of loaders submodule.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/demos/py_simple/dither.py b/demos/py_simple/dither.py index 470d601..e40221e 100755 --- a/demos/py_simple/dither.py +++ b/demos/py_simple/dither.py @@ -15,7 +15,7 @@ def main(): # Use Floyd-Steinberg dithering res = filters.FilterFloydSteinberg_RGB888_Alloc(img, core.C.PIXEL_G1, None) # Save result into grayscale png - loaders.SavePNG(res, "out.png", None) + res.loaders.SavePNG("out.png")
if __name__ == '__main__': main()
http://repo.or.cz/w/gfxprim.git/commit/057139e9ba8617156f214005b143846b6110f...
commit 057139e9ba8617156f214005b143846b6110f28d Author: Cyril Hrubis metan@ucw.cz Date: Fri Apr 19 18:20:12 2013 +0200
pywrap: loaders: Add SaveXXX functions to submodule.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/pylib/gfxprim/loaders/__init__.py b/pylib/gfxprim/loaders/__init__.py index 621099a..a9878fa 100644 --- a/pylib/gfxprim/loaders/__init__.py +++ b/pylib/gfxprim/loaders/__init__.py @@ -1,12 +1,10 @@ from . import c_loaders
- def Load(filename, callback=None): "Load image from given file, guessing the type." c = c_loaders.GP_LoadImage(filename, callback) return c
- def _init(module): "Extend Context with loaders submodule"
@@ -26,6 +24,30 @@ def _init(module): Generally, not all pixel types work with all formats. """ c_loaders.GP_SaveImage(self.ctx, filename, callback) + + @extend(LoadersSubmodule) + def SavePNG(self, filename, callback=None): + """Save the image as PNG. + + Generally, not all pixel types work with all formats. + """ + c_loaders.GP_SavePNG(self.ctx, filename, callback) + + @extend(LoadersSubmodule) + def SaveJPG(self, filename, callback=None): + """Save the image as JPEG. + + Generally, not all pixel types work with all formats. + """ + c_loaders.GP_SaveJPG(self.ctx, filename, callback) + + @extend(LoadersSubmodule) + def SaveBMP(self, filename, callback=None): + """Save the image as BMP. + + Generally, not all pixel types work with all formats. + """ + c_loaders.GP_SaveBMP(self.ctx, filename, callback)
# Imports from the SWIG module import re
-----------------------------------------------------------------------
Summary of changes: demos/py_simple/dither.py | 2 +- doc/loaders_python.txt | 45 +++++++++++++++++++++++++++++++++++++ pylib/gfxprim/loaders/__init__.py | 26 +++++++++++++++++++- 3 files changed, 70 insertions(+), 3 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.