webp
webp copied to clipboard
Delete metadata without compressing
I'd like to be able to remove metadata from a webp file without losing quality.
did you manage to find a solution?
i guess something with the DecodeRGBA function. you remove everything and you have a bare-pixels image. then you encode it again without the metadata. something like : ` //: Decode the Image img, err := webp.DecodeRGBA(data) if err != nil { log.Fatalf("Failed to decode webp: %v", err) }
// Re-encode the Image
new_data, err := webp.EncodeRGBA(img, 90) // Here 90 is the quality, adjust as needed
if err != nil {
log.Fatalf("Failed to encode webp: %v", err)
}
// Save the New Image
err = ioutil.WriteFile("output.webp", new_data, 0644) //new_data here is the re-encoded "barebones" image.
if err != nil {
log.Fatalf("Failed to write to file: %v", err)
}`
for reference : https://pkg.go.dev/github.com/chai2010/webp#DecodeRGBA https://pkg.go.dev/image#RGBA