Tom's Lemmy
  • Communities
  • Support Lemmy
  • Search
  • Login
Programming@programming.devbyMaya🍎@sh.itjust.works
4 days

imaging question in python

How do I convert a batch of .pngs into a single .apng?

9
    You must log in or register to comment.
    • Kissaki@programming.devEnglish
      3 days

      [email protected]

      • mbirth 🇬🇧@lemmy.mlEnglish
        4 days

        I’d use ImageMagick, but if you want to do it in plain* Python, here’s an example: https://stackoverflow.com/a/79683407

        * Well, you’ll need pyAPNG.

          • Maya🍎@sh.itjust.works
            4 days

            I used pillow. It has apng support now.

          • Seedlord.com@lemmy.zipEnglish
            4 days

            On top of the other advice, Pillow is definitely worth considering for this. It’s a solid library that fits this use case perfectly.

              • Maya🍎@sh.itjust.works
                4 days

                I got it to work. Yay!

                https://sh.itjust.works/pictrs/image/ae3e684e-dacd-4b98-8306-bc68715e3587.apng

                  • one_old_coder@piefed.socialEnglish
                    3 days

                    Nice shitpost! What was your code to achieve this?

                      • Maya🍎@sh.itjust.works
                        3 days

                        I currently don’t have the code. I didn’t save it…

                        I’ll give you a rough idea of what the modified code stack overflow did.

                        They imported pillow module.

                        Took the 6 labelled images from their storage.

                        Appended the images with a set delay of 100ms and saved it as one.

                        I’m not a coder, so I can’t remember the python code.

                          • one_old_coder@piefed.socialEnglish
                            3 days

                            Don’t be shy, you are a coder now. Enjoy the chaos!

                    • Maya🍎@sh.itjust.works
                      3 days

                      I don’t remember where the original code is, maybe I forgot to save it but it’s fine. I found a site that explains the apng module.

                      https://pypi.org/project/apng/

                      Programming@programming.dev

                      programming@programming.dev
                      <p>Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!</p> <p>Cross posting is strongly encoura

                      Subscribe from Remote Instance

                      Create a post
                      You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: [email protected]

                      Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

                      Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

                      Hope you enjoy the instance!

                      Rules

                      Rules

                      • Follow the programming.dev instance rules
                      • Keep content related to programming in some way
                      • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

                      Wormhole

                      Follow the wormhole through a path of communities [email protected]



                      Visibility: Public

                      This community is visible to everyone.

                      • 141 users / Day
                      • 1.13K users / Week
                      • 3.44K users / Month
                      • 8.53K users / 6 months
                      • 1 local subscriber
                      • 26.6K subscribers
                      • 1.41K Posts
                      • 13.7K Comments
                      • Modlog
                      • UI: 1.0.0-alpha.12
                      • BE: 1.0.0-alpha.15
                      • Modlog
                      • Instances
                      • Docs
                      • Code
                      • join-lemmy.org