Giter Site home page Giter Site logo

images2gif's People

Contributors

isaacgerg avatar jonathanmerklin 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

Watchers

 avatar  avatar  avatar  avatar

images2gif's Issues

Seems like generate a damaged file?

from images2gif import readGif as readGif
from images2gif import writeGif as writeGif
import os
import os.path
from PIL import Image

root = input('select folder')
giflist = []
for parent,dirnames,filenames in os.walk(root): 
    for filename in filenames:  
        # print("filename is:" + filename)
        # print("the full name of the file is:" + os.path.join(parent,filename)) 
        img = Image.open(os.path.join(parent,filename))
        giflist.append(img)
writeGif('111.gif',giflist)

Error writeGif "TypeError: only integer scalar arrays can be converted to a scalar index"

I am using the 1.0.1 version with python 2 in ubuntu 18.04 and I get this error when executing writeGif:

TypeError                                 Traceback (most recent call last)
<ipython-input-26-613e7b96e6d8> in <module>()
     22             images = [Image.fromarray(arr) for arr in images]
     23             local_gif = os.path.join(dest_dir, ff)
---> 24             writeGif(local_gif, images, duration=2)
     25         break

/usr/local/lib/python2.7/dist-packages/images2gif/images2gif.pyc in writeGif(filename, images, duration, repeat, dither, nq, subRectangles, dispose)
    569     # Check subrectangles
    570     if subRectangles:
--> 571         images, xy, images_info = gifWriter.handleSubRectangles(images, subRectangles)
    572         defaultDispose = 1 # Leave image in place
    573     else:

/usr/local/lib/python2.7/dist-packages/images2gif/images2gif.pyc in handleSubRectangles(self, images, subRectangles)
    293 
    294             # Determine the sub rectangles
--> 295             images, xy = self.getSubRectangles(images)
    296 
    297         # Done

/usr/local/lib/python2.7/dist-packages/images2gif/images2gif.pyc in getSubRectangles(self, ims)
    345 
    346             # Cut out and store
--> 347             im2 = im[y0:y1,x0:x1]
    348             prev = im
    349             ims2.append(im2)

TypeError: only integer scalar arrays can be converted to a scalar index

Can somebody provide an answer or fix it? I am loading the PIL Images using numpy arrays, I have also tryed loading png directly but i got the same error.

Many thanks!

PIL images

Hi,
Thank you very much for your work.

I tried your code and I just want to tell you about a problem I noticed with PIL images.
On line 260 you have: image_info = [im.flags for im in images ] but PIL images do not have the flag
attribute.
In order to run the code I have simply removed all the image_info and images_info variables as I saw they are never used.

Hope I told you something useful

Best regards,
Luca

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.