Search code examples
jpegimage-compressionwebp

cwebp -metadata all does not keep metadata


I am trying to use cwebp to convert and compress JPG images to webp. By default the -metadata tag is set to none. This results in some images being rotated into the wrong angle as the metadata for rotation gets lost.

When trying to use -metadata all i get the error: "Warning: only ICC profile extraction is currently supported on this platform" which results in the image being converted and compressed but none of the metadata coming along. The full command i use is: cwebp -metadata all image.JPG -o image.webp

The error makes it seem like cwebp doesn't support keeping metadata at all but i find that hard to believe. Am i doing anything wrong or should i be looking into another tool?


Solution

  • After looking around a bit i found a functional solution for this. After converting the image to .webp with cwepb you can use ExifTool to copy the metadata from the original JPG file as such: exiftool -TagsFromFile image.JPG image.webp. You can then use ImageMagick to apply the rotation with magick image.webp -auto-orient ouputImage.webp.