Coder Social home page Coder Social logo

ideamonk / pymos Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 9.0 4.62 MB

Creates beautiful mosaic for an image using a set of thumbnails

Home Page: https://ideamonk.github.io/PyMos

License: BSD 2-Clause "Simplified" License

Shell 1.64% Python 98.36%

pymos's People

Contributors

ideamonk avatar kunal avatar yuvipanda avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

pymos's Issues

List of images used for mosaic

Any chance if it is somehow possible to retrieve a list of the actual images used to build the mosaic? I'd like to be able to somehow move my mouse over the mosaic image and be able to click each and every image in the mosaic and then visit for instance a page with some background info on that very image.

I already looked around in the sourcecode for a sec but didn't find a solution right away.

Is it me or is there something wrong ?

i have the following directory structure:
/dir
-- test.jpg
-- collection/
-- small_img1.png
-- small_img2.png
-- and so on...

i invoke pymos using: me@mylaptop: ~/dir$ pymos test.jpg output.png ./collection/

this is what i see :

0
INFO:PyMos:Building index...
INFO:PyMos:Color Index built
INFO:PyMos:Generating Mosaic...
Traceback (most recent call last):
File "/usr/local/bin/pymos", line 5, in
pkg_resources.run_script('PyMos==0.6', 'pymos')
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 467, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1200, in run_script
execfile(script_filename, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/PyMos-0.6-py2.7.egg/EGG-INFO/scripts/pymos", line 59, in
new_colormap=args.new_colormap)
File "/usr/local/lib/python2.7/dist-packages/PyMos-0.6-py2.7.egg/pymos/core.py", line 128, in build_mosaic
if (colormap[match[2]][2] == None): # has not been resized yet
IndexError: list index out of range

my test.jpg is 256x256 and all collection images are 75x75

File globing behaviour

Ran into a small issue with the build_mosaic() function in core.py, line 76:

files = glob.glob(os.path.join(collection_path, '*.jpg'))

My files ended with the extention "*.JPG". The traceback or the error I got was the following:

Traceback (most recent call last):
  File "/usr/local/bin/pymos", line 5, in <module>
    pkg_resources.run_script('PyMos==0.6', 'pymos')
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 467, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 1200, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.6/dist-packages/PyMos-0.6-py2.6.egg/EGG-INFO/scripts/pymos", line 59, in <module>
    new_colormap=args.new_colormap)
  File "/usr/local/lib/python2.6/dist-packages/PyMos-0.6-py2.6.egg/pymos/core.py", line 130, in build_mosaic
    if (colormap[match[2]][2] == None):   # has not been resized yet
IndexError: list index out of range

which was rather unhelpful.

Two points:

  1. A case insensitive glob might be better here.
  2. One should make sure that the number of files is not 0 in the collection_path directory.

~
musically_ut

fail in some thumbs

Traceback (most recent call last):
File "./test", line 59, in
new_colormap=args.new_colormap)
File "build/bdist.linux-i686/egg/pymos/core.py", line 91, in build_mosaic
File "build/bdist.linux-i686/egg/pymos/core.py", line 35, in build_colormap
File "/usr/lib/python2.6/site-packages/PIL-1.1.7-py2.6-linux-i686.egg/Image.py", line 1980, in open
raise IOError("cannot identify image file")
IOError: cannot identify image file

Kunal's b/w bugs


$ pymos logo.jpg output.png images/
0
INFO:PyMos:Building index...
Traceback (most recent call last):
File "/usr/local/bin/pymos", line 5, in
pkg_resources.run_script('PyMos==0.6', 'pymos')
File "/usr/local/lib/python2.6/dist-packages/setuptools-0.6c9-py2.6.egg/pkg_resources.py", line 448, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/local/lib/python2.6/dist-packages/setuptools-0.6c9-py2.6.egg/pkg_resources.py", line 1173, in run_script
exec script_code in namespace, namespace
File "/usr/local/lib/python2.6/dist-packages/PyMos-0.6-py2.6.egg/EGG-INFO/scripts/pymos", line 59, in

File "build/bdist.linux-x86_64/egg/pymos/core.py", line 82, in build_mosaic
File "build/bdist.linux-x86_64/egg/pymos/core.py", line 43, in build_colormap
TypeError: 'int' object is unsubscriptable

For some reasons it didnt work when I had the attached image in collections folder.

  • also got to fix the b/w image issue
  • the absolute path issue

Real image collections fail

while input and output images work fine even on bigger sizes,
it was an assumption that users would supply a folder with real small thumbnails as collection param.
If some one passes a directory full of real digicam pics as collection, in most cases it freezes the user's system.

Solution - precalculations based on source dimensions and zoom factor

  • warnings when more than a tolerable number of big images are found in thumbnails.

Mega pixel exceptions needed

from @meshaabi

nah i have 2.5 gigs ram free.. source is 500 images.. worked with -z 2

btw was checking out the src.. you are checking every pixel on the image.. the index builder died when i tried to use the 7.1 megpix pics from my camera..

maybe could check pixel blocks or first generate a thumbnail itself before getting to average pixel counting

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.