1e41f4b71Sopenharmony_ci# Editing EXIF Data 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ciThe image tool provides the capabilities of reading and editing Exchangeable Image File Format (EXIF) data of an image. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ciEXIF is a file format dedicated for photos taken by digital cameras and is used to record attributes and shooting data of the photos. Currently, the image tool supports images in JPEG format only. 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ciUsers may need to view or modify the EXIF data of photos in the Gallery application, for example, when the manual lens parameters of the camera are not automatically written as part of the EXIF data or the shooting time is incorrect due to camera power-off. 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ciCurrently, OpenHarmony allows you to view and modify part of EXIF data. For details, see [Exif](../../reference/apis-image-kit/js-apis-image.md#propertykey7). 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci## How to Develop 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ciRead [Image](../../reference/apis-image-kit/js-apis-image.md#getimageproperty11) for APIs used to read and edit EXIF data. 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci1. Obtain the image and create an **ImageSource** object. 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci ```ts 18e41f4b71Sopenharmony_ci // Import the required module. 19e41f4b71Sopenharmony_ci import { image } from '@kit.ImageKit'; 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci // Obtain the sandbox path and create an ImageSource object. 22e41f4b71Sopenharmony_ci const fd : number = 0; // Obtain the file descriptor of the image to be processed. 23e41f4b71Sopenharmony_ci const imageSourceApi : image.ImageSource = image.createImageSource(fd); 24e41f4b71Sopenharmony_ci ``` 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci2. Read and edit EXIF data. 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_ci ```ts 29e41f4b71Sopenharmony_ci import { BusinessError } from '@kit.BasicServicesKit'; 30e41f4b71Sopenharmony_ci // Read the EXIF data, where BitsPerSample indicates the number of bits per pixel. 31e41f4b71Sopenharmony_ci let options : image.ImagePropertyOptions = { index: 0, defaultValue: '9999' } 32e41f4b71Sopenharmony_ci imageSourceApi.getImageProperty(image.PropertyKey.BITS_PER_SAMPLE, options).then((data : string) => { 33e41f4b71Sopenharmony_ci console.log('Succeeded in getting the value of the specified attribute key of the image.'); 34e41f4b71Sopenharmony_ci }).catch((error : BusinessError) => { 35e41f4b71Sopenharmony_ci console.error('Failed to get the value of the specified attribute key of the image.'); 36e41f4b71Sopenharmony_ci }) 37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ci // Edit the EXIF data. 39e41f4b71Sopenharmony_ci imageSourceApi.modifyImageProperty(image.PropertyKey.IMAGE_WIDTH, "120").then(() => { 40e41f4b71Sopenharmony_ci imageSourceApi.getImageProperty(image.PropertyKey.IMAGE_WIDTH).then((width : string) => { 41e41f4b71Sopenharmony_ci console.info('The new imageWidth is ' + width); 42e41f4b71Sopenharmony_ci }).catch((error : BusinessError) => { 43e41f4b71Sopenharmony_ci console.error('Failed to get the Image Width.'); 44e41f4b71Sopenharmony_ci }) 45e41f4b71Sopenharmony_ci }).catch((error : BusinessError) => { 46e41f4b71Sopenharmony_ci console.error('Failed to modify the Image Width'); 47e41f4b71Sopenharmony_ci }) 48e41f4b71Sopenharmony_ci ``` 49