Convert Images From PNG TO WEBP In Backend WorkFlow

Hi, i am retrieving some images via API in the backend workflow. Before i save them to the database, i want to convert from PNG to WEBP before saving them. How can i do that without paying another API service?