울트라 HDR 이미지 형식은 기기에서 더 강렬한 색상으로 더 밝은 이미지를 표시할 수 있는 휘도 정보를 인코딩합니다. 앱에서 Ultra HDR 이미지를 편집할 때는 휘도 정보를 유지해야 합니다. 이는 사용자의 기기에서 최대 강도로 울트라 HDR 이미지를 표시하지 못하는 경우에도 중요합니다. 결국 사용자는 울트라 HDR을 지원하는 기기를 사용하는 사람에게 이미지를 공유하거나 이미지를 저장한 후 몇 년 후에 새 기기에서 다시 볼 수 있습니다.
다행히도 비트맵을 수정하는 대부분의 Android 메서드는 울트라 HDR 이미지 형식을 지원합니다. 이미지를 자르거나 회전하는 등 기본적인 수정을 하는 경우 표준 Android 메서드를 사용하면 됩니다. 그러면 새로운 크기나 방향의 울트라 HDR 이미지가 생성됩니다.
이미지 내용을 수정하는 경우 작업이 더 까다로워집니다. 이 경우 표준 편집 방법을 사용하면 이전 이미지의 밝기 정보가 유지되므로 원하는 결과가 아닐 수 있습니다. 이러한 경우 올바른 결과를 얻으려면 게인 맵 (이미지의 밝기 정보를 인코딩함)을 수정하거나 삭제해야 할 수 있습니다.
울트라 HDR 형식 개요
울트라 HDR 이미지 형식은 울트라 HDR 이미지 사양에 자세히 설명되어 있습니다. 가장 중요한 점은 울트라 HDR 이미지에 기본 이미지와 게인 맵이 모두 포함된다는 것입니다.
기본 이미지에는 이미지의 각 픽셀에 대한 색상 정보가 있습니다.
게인 맵은 기본 이미지와 비율이 동일한 표준 JPEG 이미지입니다(픽셀 크기는 동일하지 않을 수 있음). 게인 맵의 각 픽셀은 기본 이미지의 해당 부분의 휘도를 지정합니다.
게인 맵은 그레이 스케일 또는 컬러일 수 있습니다. 게인 맵이 컬러인 경우 게인 맵의 각 컬러 채널은 기본 이미지의 해당 부분에 있는 해당 컬러 채널의 휘도를 지정합니다. 게인 맵이 그레이스케일인 경우 게인 맵의 각 픽셀은 기본 이미지의 해당 부분에 있는 세 가지 색상 채널의 휘도를 지정합니다.
게인 맵은 기본 이미지와 비율이 동일해야 하지만 픽셀 크기는 동일하지 않아도 됩니다. 실제로 Android 플랫폼에서 Ultra HDR 이미지를 만들 때 기본 이미지보다 너비와 높이가 작은 게인 맵을 만듭니다. 이렇게 하면 파일 크기가 훨씬 작아지지만 좋은 결과를 얻을 수 있는 충분한 정보가 인코딩됩니다. 즉, 게인 맵의 각 픽셀은 기본 이미지의 여러 픽셀에 대한 휘도 정보를 저장할 수 있습니다.
기본 울트라 HDR 편집
Android Bitmap API를 사용하여 울트라 HDR 이미지를 기본적으로 변환하는 경우 메서드는 게인 맵을 적절하게 변경합니다. 다음 Bitmap 작업이 지원됩니다.
회전: 울트라 HDR 이미지를 회전하면 게인 맵도 회전됩니다.
자르기: 울트라 HDR 이미지를 자르면 이 메서드는 게인 맵을 적절하게 자릅니다.
크기 조절: 울트라 HDR 이미지의 크기를 조절하면 메서드는 크기가 조절된 기본 이미지의 너비와 높이가 절반인 게인 맵의 크기를 조절합니다.
각 경우에 휘도 정보는 유지됩니다.
고급 울트라 HDR 편집
울트라 HDR 이미지를 더 정교하게 수정하면 게인 맵이 변경되지 않고 유지되므로 원하는 결과가 나오지 않을 수 있습니다.
이러한 상황을 초래할 수 있는 일반적인 수정사항은 다음과 같습니다.
스티커 또는 그림 이모티콘 추가: 추가된 스티커의 밝기와 색상 선명도 값이 스티커가 붙여진 영역과 동일합니다.
두 번째 이미지 오버레이: 새 이미지는 오버레이되는 콘텐츠의 광도 및 색상 선명도 정보를 사용합니다.
필터 추가: 수정된 기본 이미지에 이전 게인 맵의 정보가 적합하지 않을 수 있습니다.
각 경우에 이전 휘도 및 색상 선명도 정보는 보존되지만 수정된 이미지에는 적합하지 않을 수 있습니다.
원본 게인 맵이 수정된 이미지에 적합한 경우 아무 작업도 하지 않아도 됩니다. 게인 맵을 수정하려면 일반적인 워크플로는 다음과 같습니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-08-27(UTC)
[null,null,["최종 업데이트: 2025-08-27(UTC)"],[],[],null,["# Edit Ultra HDR images\n\nThe [Ultra HDR image format](/guide/topics/media/platform/hdr-image-format) encodes luminosity information\nthat lets devices display brighter\nimages with more intense colors. When your app edits an Ultra HDR image, you\nwant to make sure to preserve that luminosity information. This is important even if the\nuser's device doesn't support displaying an Ultra HDR image at full\nintensity. After all, the user might share their image to someone with a device\nthat supports Ultra HDR, or they might save that image and look at it again on a\nnew device years later.\n\nThe good news is most Android methods for editing bitmaps support the Ultra HDR\nimage format. If you're making basic edits to an image, like cropping or\nrotating it, the standard Android methods do the job---you'll end up with an\nultra HDR image with the new dimensions or orientation.\n\nThe job is trickier if you're modifying the contents of the image. In those\ncases, the standard editing methods preserve the luminosity information of the\n*old* image, which might not be what you want. In those cases, you might need to\nedit or remove the gain map (which encodes the image's luminosity information)\nto get the right result.\n\n### Ultra HDR format overview\n\nThe Ultra HDR image format is described in detail in the [Ultra HDR Image\nspecification](/guide/topics/media/platform/hdr-image-format). The most important thing to understand is an\nUltra HDR image contains both a *primary image* and a *gain map*.\n\n- The *primary image* has the color information for each pixel of the image.\n- The *gain map* is a standard JPEG image with the same proportions as the primary image, though not necessarily the same pixel dimensions. Each pixel of the gain map specifies the luminance of the corresponding part of the primary image.\n\nThe gain map can be either grayscale or color. If the gain map is in color, each\ncolor channel on the gain map specifies the luminance of that color channel on\nthe corresponding part of the primary image. If the gain map is grayscale, each\npixel of the gain map specifies the luminance of all three color channels on\nthat portion of the primary image.\n\nThe gain map must have the same proportions as the primary image, but it does\nnot have to have the same pixel dimensions. In fact, when the Android platform\ncreates Ultra HDR images, it creates a gain map with a smaller width and height\nthan the primary image; doing so makes the file size significantly smaller, but\nstill encodes enough information for a good result. This means that each pixel\nin the gain map might store the luminance information for several pixels in the\nprimary image.\n\n### Basic Ultra HDR edits\n\nIf you use the Android [`Bitmap`](/reference/android/graphics/Bitmap) APIs to make\nbasic transformations to an Ultra HDR image, the methods make the appropriate\nchanges to the gain map. The following `Bitmap` operations are supported:\n\n- **Rotate:** If you rotate an Ultra HDR image, the method rotates the gain map too.\n- **Crop:** If you crop an Ultra HDR image, the method crops the gain map appropriately.\n- **Scale:** If you scale an Ultra HDR image, the method scales the gain map so it has half the width and half the height of the resized primary image.\n\nIn each case, the luminosity information is preserved.\n\n### Advanced Ultra HDR edits\n\nIf you make more elaborate edits to an Ultra HDR image, the gain map is\npreserved unchanged, which may not give you the results you want.\n\nCommon edits that might result in this situation include:\n\n- **Adding stickers or emoji:** The added sticker would have the same luminosity and color vividness values as the area it was pasted on.\n- **Overlaying a second image:** The new image would use the luminosity and color vividness information of the content it's overlaying.\n- **Adding filters:** The old gain map's information might not be appropriate for the modified primary image.\n\nIn each case, the old luminosity and color vividness information is preserved,\nbut it might not be appropriate for the modified image.\n\nIf the original gain map is appropriate for the edited image, you don't have to\ndo anything. If you *do* want to modify the gain map, the usual workflow is:\n\n1. **Fetch the image's current gain map** by calling [`Bitmap.getGainmap()`](/reference/android/graphics/Bitmap#getGainmap()) and cache it.\n2. **Modify the primary image as desired.**\n3. **Make corresponding edits to the cached gain map.** For example, if you\n pasted an emoji onto the primary image, you might set the corresponding\n portion of the gain map to a neutral value, like [`Color.GRAY`](/reference/android/graphics/Color#GRAY).\n\n | **Important:** The gain map might not have the same pixel dimensions as the primary image. For this reason, you need to calculate the appropriate pixels on the gain map that correspond to the edited areas on the primary image. For example, suppose the primary image is 8,000×4,000 pixels, and the gain map is 2,000×1,000 pixels. If you edit pixel (500,600) on the primary image, the corresponding pixel on the gain map would be at location (125,150).\n4. **Apply the modified gain map back to the image** by calling\n [`Bitmap.setGainmap()`](/reference/android/graphics/Bitmap#setGainmap(android.graphics.Gainmap))).\n\n### Additional resources\n\nTo learn more about Ultra HDR images, see the following additional resources:\n\n- [Ultra HDR image format specification](/guide/topics/media/platform/hdr-image-format)"]]