diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..25ad1669f5270c8a59a063e7c3346d9f8cdc9487 --- /dev/null +++ b/README.en.md @@ -0,0 +1,41 @@ +# Obtaining and Saving an Image +## Overview +Based on HarmonyOS APIs such as **Media Library Kit** and **Image Kit**, this sample shows how to implement the functions of obtaining an image, reading image information, and saving an image on HarmonyOS. +## Preview +![](./screenshots/device/image.en.png) + +## How to Implement +1. There are four methods to obtain an image: the **Photo Picker** component, **PhotoViewPicker** API, **CameraPicker** API, and **DocumentViewPicker** API. +2. The **getImageInfo** and **getImageProperties** methods are used to read image information. +3. Use the **imageSource.createPixelMap()** method to create an object of **PixelMap**. +4. The security component and **photoAccessHelper** module are used to save an image. + +## How to Use +1. Tap the Obtaining an Image button. On the displayed page, select a method and obtain the corresponding image. +2. Tap the Reading Image Information button to read the image information. +3. Tap the Creating an Object of PixelMap button to convert the image into an object of **PixelMap**. +4. Tap the Save button. On the displayed page, select Save to App Sandbox or Save to Gallery to store the image to the corresponding location. + +## Project Directory +``` +├──ets +│ ├──common +│ │ └──utils +│ │ └──Utils.ets // Common utilities +│ ├──entryability +│ │ └──EntryAbility.ets +│ ├──entrybackupability +│ │ └──EntryBackupAbility.ets +│ └──pages +│ └──Index.ets // Home page +└──resources // Resources +``` + +## Permissions +N/A + +## Constraints +1. The sample is only supported on Huawei phones with standard systems. +2. The HarmonyOS version must be HarmonyOS 5.0.0 Release or later. +3. The DevEco Studio version must be DevEco Studio 5.0.0 Release or later. +4. The HarmonyOS SDK version must be HarmonyOS 5.0.0 Release SDK or later. \ No newline at end of file diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index 80137f8f3ae2998db9dd1829b21599e831c1182b..dd763408c552e7305be24b2656509813550e14da 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -14,7 +14,7 @@ }, { "name": "title", - "value": "title" + "value": "Obtaining and Saving an Image" }, { "name": "get_image", diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json index 80137f8f3ae2998db9dd1829b21599e831c1182b..dd763408c552e7305be24b2656509813550e14da 100644 --- a/entry/src/main/resources/en_US/element/string.json +++ b/entry/src/main/resources/en_US/element/string.json @@ -14,7 +14,7 @@ }, { "name": "title", - "value": "title" + "value": "Obtaining and Saving an Image" }, { "name": "get_image", diff --git a/screenshots/device/image.en.png b/screenshots/device/image.en.png new file mode 100644 index 0000000000000000000000000000000000000000..e25bbd8fba3cfdc47b5856a88bb8bf65e2b11f98 Binary files /dev/null and b/screenshots/device/image.en.png differ