Giter Site home page Giter Site logo

Bad GIF quality about rlottie-python HOT 4 CLOSED

laggykiller avatar laggykiller commented on June 11, 2024
Bad GIF quality

from rlottie-python.

Comments (4)

laggykiller avatar laggykiller commented on June 11, 2024

This issue is not quite related to this library...

However, I did found this issue: python-pillow/Pillow#4941

Hope this helps! If not, please share the tgs so I can take a look.

from rlottie-python.

star-39 avatar star-39 commented on June 11, 2024

Oh, you seems right!

But my thought is to make this library produce better quality GIFs, so it's somehow related? Please allow me to edit the issue descriptions.

Anyway, thanks for your attention! If you think current procedure is fine, then... it's fine! Not a big problem after all.

from rlottie-python.

laggykiller avatar laggykiller commented on June 11, 2024

I see, but if I want the library to produce high quality GIF with Image.LIBIMAGEQUANT, then I have to somehow include custom compiled Pillow with support for libimagequant as dependency in this project, which I think is a feature creep. I think this job should be left to users, as there is many ways to quantize a image (e.g. number of colors, method), each with pros and cons (e.g. File size, image quality), and there is no single best method. Users should decide how their image be quantized based on their use case.

If users want to create gif with Image.LIBIMAGEQUANT, they can just easily (?):

from rlottie_python import LottieAnimation
from PIL import Image

anim = LottieAnimation.from_file('example/sample.json')
totalframe = anim.lottie_animation_get_totalframe()
frame_duration = 1000 / anim.lottie_animation_get_framerate()

im_list = []
for frame in range(totalframe):
    im = anim.render_pillow_frame(frame_num=frame)
    im = im.quantize(255, method=Image.LIBIMAGEQUANT)
    im_list.append(im)

im_list[0].save('animation.gif', save_all=True, append_images=im_list[1:], duration=int(frame_duration))

from rlottie-python.

star-39 avatar star-39 commented on June 11, 2024

Not exactly that you must use Image.LIBIMAGEQUANT to improve quality.... I just happen to found that it did.

Well, if you think current save_animation result is okay, then it's okay! Thank you.

from rlottie-python.

Related Issues (6)

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.