I am working on a project where a user can upload webp images. I know how to convert webp images into jpg/png, but am stuck on how to identify whether the webp image is static (non-animated) or animated.
I want to identify them because I use different commands for conversion:
Command for non-animated webp to jpg:
dwebp nonanimated.webp -o jpg.jpg
Command for animated webp to non-animated webp (takes 2nd frame):
webpmux -get frame 2 animated.webp -o nonanimated.webp
But I cannot find a single command that handle both cases.
I am using PHP on the server side, and HTML and Javascript for frontend.