Back to Community

How to Preserve EXIF and IPTC Metadata in WebP Images

Content

Many photographers and website owners rely on metadata like EXIF and IPTC to store important information such as copyright details, creator credits, camera settings, and GPS location. A common issue reported by users of the 'Converter for Media – Optimize images | Convert WebP & AVIF' plugin is that this metadata is stripped during the conversion process to WebP. This guide explains why this happens and the most effective solutions.

Why is My Metadata Being Removed?

The removal of metadata is not a bug in the plugin but a consequence of the underlying image processing libraries it uses and a default setting designed to optimize file size.

  • GD Library Limitation: If your server uses the GD library for conversion, it does not have the capability to preserve metadata. This is a technical limitation of the GD library itself, not the plugin. All EXIF, IPTC, and other metadata will be lost when using this method.
  • Imagick Library Default Behavior: The more advanced Imagick library is capable of preserving metadata. However, by default, the plugin is configured to strip this data to achieve the smallest possible file sizes, which is the primary goal for most users.

How to Keep Your Metadata

If preserving metadata is crucial for your SEO, copyright, or other needs, follow these steps.

Solution 1: Use the Built-in Plugin Setting (Imagick Only)

The simplest solution is to use the Imagick library and enable the plugin's setting.

  1. Verify your server supports the Imagick library with WebP support. You can check this in the plugin's "Server Info" tab.
  2. In your WordPress admin panel, go to Settings > Converter for Media.
  3. Click on the "Advanced Settings" tab.
  4. Find and check the option labeled "Keep images metadata stored in EXIF or XMP formats (only available for Imagick conversion method)".
  5. Save your changes.
  6. You may need to regenerate your WebP images for the change to take effect on existing conversions.

Solution 2: Manual Code Edit (For Advanced Users)

Some user reports indicate that even with the setting enabled, certain metadata might still be stripped. If you are comfortable editing plugin files, you can try a manual override. Warning: This edit will be overwritten when the plugin updates.

  1. Access your website's files via FTP, SFTP, or your hosting provider's file manager.
  2. Navigate to the plugin's directory: /wp-content/plugins/webp-converter-for-media/
  3. Open the file: /app/Convert/Imagick.php
  4. Find the line of code: $image->stripImage();
  5. Delete or comment out this line (e.g., put two slashes in front of it: // $image->stripImage();).
  6. Save the file and upload it back to your server, overwriting the old one.
  7. Clear your cache and regenerate your WebP images.

This manual solution has been suggested by the 'Converter for Media' team in support threads to users experiencing this specific issue.

What If I Can't Use Imagick?

If your web host does not support the Imagick library, your only option for preserving metadata is to switch to a conversion method that supports it. Unfortunately, the GD library will always remove metadata. You would need to contact your hosting provider to ask if they can install or enable the Imagick PHP extension on your server.

Conclusion

Preserving image metadata in WebP files is possible but requires using the Imagick library. First, enable the official setting in the plugin's advanced options. If that does not fully resolve the issue for your specific images, the manual code edit is a known workaround. For users stuck with the GD library, preserving metadata during conversion is not currently possible with this plugin.