Coder Social home page Coder Social logo

pymaging's Introduction

pymaging's People

Contributors

cgroner avatar craigds avatar homm avatar jtauber avatar ojii avatar sirpengi avatar superdmp avatar suzaku avatar wesm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pymaging's Issues

Flipping horizontally also flips vertically

I've been trying to flip an image both horizontally and then vertically in order to achieve a 180 degree rotation.

Using

flipped_horizontally_image = image.flip_left_right()
flipped_vertically_image = flipped_horizontally_image.flip_top_bottom()

the resulting image has the the same vertical orientation as the original image.

If I only use flip_left_right(), I find that the image is already flipped vertically in addition to horizontally, so flip_top_bottom() just ends up canceling out the vertical flip.

Image.thumbnail

Add an Image.thumbnail function. Maybe with fancy stuff such as focal points?

Please wrap up a PyPi release

Downloading pymaging via git is unfriendly and insecure. It's unsuitable for production use and makes it improper to depend on it from any other Python package.

Please wrap up a proper release and upload it to pypi so that we could install it via pip easily and dep on it from other packages without deferring it to the VCS.

Up-resizing doesn't work (nearest neighbor)

I added a test case to resize up (2x2 to 4x4) and got this:

ERROR: test_resize_nearest_resampling_up (pymaging.tests.test_resampling.ResizeNearestResamplingTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/cdestigter/checkout/pymaging/pymaging/tests/test_resampling.py", line 23, in test_resize_nearest_resampling_up
    img = img.resize(4, 4)
  File "/Users/cdestigter/checkout/pymaging/pymaging/image.py", line 101, in resize
    pixels = resample_algorithm(self, width, height, self.pixelsize)
  File "/Users/cdestigter/checkout/pymaging/pymaging/resample.py", line 46, in nearest
    lineextend(source.pixels[source_y][source_x_start:source_x_end])
IndexError: list index out of range

Fix forthcoming

I/O error on quickstart

When trying to run the quickstart example,

from pymaging import Image

img = Image.open_from_path('myimage.png')
img = img.resize(300, 300)
img.save('resized.png')

the program halts with an I/O operation on closed file error.

It can be circumvented as follows:

Image.open(file('myimage.png','rb'))

Cannot open jpg despite having pymaging-jpg installed

I get the following:

>>> from pymaging.image import Image
>>> img_part = Image.open_from_path('spheres/peter5/images/peter5_0_0_0.jpg')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "src/pymaging/pymaging/image.py", line 62, in open_from_path
    return cls.open(fobj)
  File "src/pymaging/pymaging/image.py", line 57, in open
    raise FormatNotSupported()
pymaging.exceptions.FormatNotSupported

setup.py

write a good and working setup.py script. figure out how to handle incubator in that.

pymaging.incubator.formats.tests.PNGTests.test_non_indexed_interlaced fails in Python 3.x

======================================================================
ERROR: test_non_indexed_interlaced (pymaging.incubator.formats.tests.PNGTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jonas/workspace/pymaging/pymaging/incubator/formats/tests.py", line 56, in test_non_indexed_interlaced
    img = Image.open_from_path(_get_filepath('black-white-non-indexed-interlaced-adam7.png'))
  File "/home/jonas/workspace/pymaging/pymaging/image.py", line 62, in open_from_path
    return cls.open(fobj)
  File "/home/jonas/workspace/pymaging/pymaging/image.py", line 54, in open
    image = format.open(fileobj)
  File "/home/jonas/workspace/pymaging/pymaging/incubator/formats/png.py", line 37, in open
    return reader.get_image()
  File "/home/jonas/workspace/pymaging/pymaging/incubator/formats/png_reader.py", line 353, in get_image
    handler(chunk_data, chunk_length)
  File "/home/jonas/workspace/pymaging/pymaging/incubator/formats/png_reader.py", line 482, in handle_chunk_IHDR
    self.adam7 = Adam7(self)
  File "/home/jonas/workspace/pymaging/pymaging/incubator/formats/png_reader.py", line 244, in __init__
    self.init()
  File "/home/jonas/workspace/pymaging/pymaging/incubator/formats/png_reader.py", line 261, in init
    self.current_y = self.yiter.next()
AttributeError: 'itertools.islice' object has no attribute 'next'

img.save_to_path problem

I'm testing the lib and, both in Python 2.7 and Python 3.2, when I use img.save_to_path(), I get this exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/marco/Desktop/virtualenvs/py32/src/pymaging/pymaging/image.py", line 76, in save_to_path
    self.save(fobj, format)
  File "/Users/marco/Desktop/virtualenvs/py32/src/pymaging/pymaging/image.py", line 70, in save
    format_object.encode(self, fileobj)
  File "/Users/marco/Desktop/virtualenvs/py32/src/pymaging-png/pymaging_png/png.py", line 46, in encode
    writer.write(fileobj, image.pixels)
  File "/Users/marco/Desktop/virtualenvs/py32/src/pymaging-png/pymaging_png/raw.py", line 631, in write
    nrows = self.write_passes(outfile, rows)
  File "/Users/marco/Desktop/virtualenvs/py32/src/pymaging-png/pymaging_png/raw.py", line 755, in write_passes
    enumrows = enumerate(rows)
TypeError: 'PixelArray3' object is not iterable

(I'm testing with png images, after installing png support)

I just tested the resize image sample code on the website (using save_to_path(9 instead of save()):

from pymaging import Image
img = Image.open_from_path('myimage.png')
img = img.resize(300, 300)
img.save_to_path('resized.png')

Quickstart example

"""
Have to change code in image.py so file is not prematurely closed:
  def open_from_path(cls, filepath):
      #jtk with open(filepath, 'rb') as fobj:
          fobj = open(filepath, 'rb')   # jtk
          return cls.open(fobj)    
Have to change Quickstart example
  http://pymaging.readthedocs.org/en/latest/usr/quickstart.html
to cleanup after resize().
Also, save() does not work
"""
from pymaging import Image
img = Image.open_from_path('test1-960x720.png')
img = img.resize(300, 300)
img.width, img.height = 300,300
img.save_to_path('test1-300x300.png')

Wondering about pkg_resources

I want to use this module in an app I'm working on for BB10 (https://github.com/krruzic/snappy) but this line in formats.py is making it not work. setup_tools isn't available on BlackBerry obviously and I don't even get what you're doing with it here. Any advice on how I could get it to work or what's going on would be appreciated.

Tests don't work on Python 2.6

ERROR: test_format_registration (pymaging.tests.test_basic.DrawTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mgorny/git/pymaging/pymaging/tests/test_basic.py", line 301, in test_format_registration
    self.assertIsInstance(img, Image)
AttributeError: 'DrawTests' object has no attribute 'assertIsInstance'

----------------------------------------------------------------------

The assertIsInstance() function is not available in Python 2.6. Possible solutions:

  1. Use unittest2.TestCase as base class in Python 2.6,
  2. Re-implement it in pymaging in Python 2.6,
  3. Replace its use with assertTrue(isinstance(...)) or something similar.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.