다음을 통해 공유


ExifInterface.SaveAttributes Method

Definition

Save the tag data into the original image file.

[Android.Runtime.Register("saveAttributes", "()V", "GetSaveAttributesHandler")]
public virtual void SaveAttributes ();
[<Android.Runtime.Register("saveAttributes", "()V", "GetSaveAttributesHandler")>]
abstract member SaveAttributes : unit -> unit
override this.SaveAttributes : unit -> unit
Attributes

Exceptions

Remarks

Save the tag data into the original image file. This is expensive because it involves copying all the data from one file to another and deleting the old file and renaming the other. It's best to use #setAttribute(String,String) to set all attributes to write and make a single call rather than multiple calls for each attribute.

This method is supported for JPEG, PNG, and WebP files. <p class="note"> Note: after calling this method, any attempts to obtain range information from #getAttributeRange(String) or #getThumbnailRange() will throw IllegalStateException, since the offsets may have changed in the newly written file.

For WebP format, the Exif data will be stored as an Extended File Format, and it may not be supported for older readers.

For PNG format, the Exif data will be stored as an "eXIf" chunk as per "Extensions to the PNG 1.2 Specification, Version 1.5.0".

<b>Warning:</b> Calling this method on a DNG-based instance of ExifInterface may result in the original image file being overwritten with invalid data on some versions of Android 13 (API 33).

Java documentation for android.media.ExifInterface.saveAttributes().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to