Strip EXIF metadata from all JPEG images.

Strip all EXIF metadata from all JPEGs by re-encoding the JPEG. This
will keep all of the necessary visual effects of the tags (by encoding
them directly in the image data) while stripped the EXIF tags
themselves.
This commit is contained in:
Greyson Parrelli
2018-03-19 11:22:39 -07:00
committed by Moxie Marlinspike
parent 10e5b24cfd
commit 7e1e666172
5 changed files with 20 additions and 6 deletions

View File

@@ -149,6 +149,10 @@ public class MediaUtil {
return isGif(attachment.getContentType());
}
public static boolean isJpeg(Attachment attachment) {
return isJpegType(attachment.getContentType());
}
public static boolean isImage(Attachment attachment) {
return isImageType(attachment.getContentType());
}
@@ -169,6 +173,10 @@ public class MediaUtil {
return !TextUtils.isEmpty(contentType) && contentType.trim().equals("image/gif");
}
public static boolean isJpegType(String contentType) {
return !TextUtils.isEmpty(contentType) && contentType.trim().equals(IMAGE_JPEG);
}
public static boolean isFile(Attachment attachment) {
return !isGif(attachment) && !isImage(attachment) && !isAudio(attachment) && !isVideo(attachment);
}