durum
durum

Reputation: 3404

How to modify default Exif metadata output in R

When I save a plot in R the image file gets littered with useless Exif metadata:

...
Profile File Signature          : acsp
...
Device Manufacturer             : appl
Device Attributes               : Reflective, Glossy, Positive, Color
...
Profile Creator                 : app
Profile ID                      : 0
Profile Description             : Generic RGB Profile
...
Profile Copyright               : Copyright 2007 Apple Inc., all rights reserved.
...

Where does it come from? Can I modify the Exif metadata that is generated globally or every time I plot an image?

Here is an example:

png("test.png")
plot(Sepal.Length ~ Species, iris)
dev.off()

I am using:

Upvotes: 1

Views: 371

Answers (1)

HAVB
HAVB

Reputation: 1888

To clear the EXIF metadata, you can install imagemagick on your system and then invoke it from R via system call:

png("test.png")
plot(Sepal.Length ~ Species, iris)
dev.off()

# Strip metadata with an imagemagick command: convert input_file -strip output_file  
system("convert test.png -strip test.png")

Ideally, you would use the magick package from CRAN, but AFAIK it doesn't support the strip function, so I guess a system call is the next best thing.

Upvotes: 1

Related Questions