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

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.
    • mbirth 🇬🇧@lemmy.mlEnglish
      2 months

      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
          2 months

          I used pillow. It has apng support now.

        • Seedlord.com@lemmy.zipEnglish
          2 months

          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
              2 months

              I got it to work. Yay!

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

                • one_old_coder@piefed.socialEnglish
                  2 months

                  Nice shitpost! What was your code to achieve this?

                    • Maya🍎@sh.itjust.works
                      2 months

                      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
                          2 months

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

                  • Kissaki@programming.devEnglish
                    2 months

                    [email protected]

                    • Maya🍎@sh.itjust.works
                      2 months

                      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.

                      • 202 users / Day
                      • 576 users / Week
                      • 3.13K users / Month
                      • 8.65K users / 6 months
                      • 1 local subscriber
                      • 27.4K subscribers
                      • 1.66K Posts
                      • 16.4K Comments
                      • Modlog
                      • UI: 1.0.0-alpha.12
                      • BE: 1.0.0-alpha.15
                      • Modlog
                      • Instances
                      • Docs
                      • Code
                      • join-lemmy.org