You can use ImageMagick to display the EXIF info of a image file and remove the EXIF info from the file.
1 2 3 4 5 6
# Check the EXIF info of a given image file. identify -format '%[EXIF:*]' IMG_6223.JPG # Convert the file into another one without EXIF. convert IMG_6223.JPG -strip IMG_6223_updated.JPG # Check the updated image file without the EXIF info. identify -format '%[EXIF:*]' IMG_6223_updated.JPG
<head> <metacharset="utf-8"> <title>EXIF</title> <!-- A mimic of "https://knicknic.github.io/imagemagick/rotate/" --> </head>
<body> <BR> <p>Source image: </p> <imgid="srcImage"src="source.jpg"> <BR> <br> <p>Strip the EXIF info from the source image and create the updated one: </p> <imgid="strippedImage">
<scripttype='module'> //import the library to talk to imagemagick import * asMagickfrom'https://knicknic.github.io/wasm-imagemagick/magickApi.js'; // various html elements let strippedImage = document.getElementById('strippedImage'); // Fetch the image to rotate, and call image magick letDoMagickCall = asyncfunction () { let fetchedSourceImage = awaitfetch("source.jpg"); let arrayBuffer = await fetchedSourceImage.arrayBuffer(); let sourceBytes = newUint8Array(arrayBuffer); // calling image magick with one source image, and command to rotate & resize image const files = [{ 'name': 'srcFile.jpg', 'content': sourceBytes }]; const command = ["convert", "srcFile.jpg", "-strip", "out.jpg"]; let processedFiles = awaitMagick.Call(files, command); // response can be multiple files (example split) // here we know we just have one let firstOutputImage = processedFiles[0] strippedImage.src = URL.createObjectURL(firstOutputImage['blob']) console.log("created image " + firstOutputImage['name']) }; DoMagickCall(); </script> </body>
</html>
Then copy a “source.jpg” file to the same directory of this HTML file, which has some EXIF information in it.
Run the following command to start a simple HTTP server:
1
python -m http.server
Open a browser and go to “http://localhost:8000/“, save the second image on the page to local file system and check. You can see that the EXIF info is removed. This shows the power of “WASM-ImageMagick” which compiles ImageMagick to pure JavaScript code via WebAssembly.