Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Ultra HDR görüntü biçimi, görüntülerin ışık yoğunluğu hakkında daha fazla bilgi depolamasını sağlar. Bu sayede daha ayrıntılı parlak alanlar ve gölgeler ile daha yoğun renkler elde edilir. Android, Android 14 (API düzeyi 34) sürümünden itibaren Ultra HDR görüntüleri destekler. Uygulamanız bu sürümlerde çalışıyorsa uygulamanızı bu resimleri düzgün şekilde gösterecek şekilde yapılandırmanız önemlidir. Diğer yandan, uygulamanız Ultra HDR görüntüleri göstermiyorsa Ultra HDR ekranı etkinleştirmeyerek cihaz kaynaklarından tasarruf edebilirsiniz. Bu sayfada, grafiklerin Ultra HDR'yi destekleyip desteklemediğini nasıl kontrol edeceğiniz ve bunları nasıl düzgün şekilde görüntüleyeceğiniz açıklanmaktadır.
Kazanç haritası olup olmadığını kontrol edin.
Ultra HDR resimler kazanç haritası içerir. Kazanç haritası, görüntüdeki her pikselin artan parlaklığını belirlemek için kullanılır. Bir resmin Ultra HDR biçiminde olup olmadığını doğrulamak için resmi veya çizilebilir öğeyi Bitmap biçimine dönüştürün ve kazanç haritası olup olmadığını kontrol etmek için Bitmap.hasGainMap()'ı (Android 14'ten itibaren kullanılabilir) çağırın.
Pencerenizi Ultra HDR gösterecek şekilde yapılandırma
Ultra HDR görüntüleri tam dinamik aralıkta göstermek için pencerenin renk modunu ActivityInfo.COLOR_MODE_HDR olarak ayarlayın. Bunu, pencerenin setColorMode() yöntemini çağırarak yapabilirsiniz. (Bu API'ler Android 8'den itibaren kullanılabilir ancak cihazda Android 14 veya daha yeni bir sürüm yüklü değilse görüntüler Ultra HDR olarak gösterilmez.)
Özet
Aşağıdaki kodda tüm sürecin nasıl göründüğü gösterilmektedir. Bu kod, bir resmin bit eşleme olarak yüklendiğini varsayar ve resimde kazanç haritası olup olmadığını kontrol eder. Bu durumda kod, pencerenin renk modunu COLOR_MODE_HDR olarak değiştirir. Resimde kazanç haritası yoksa kod, pencereyi varsayılan renk moduna geçirir.
Kotlin
valbitmap=/* Get Bitmap from Image Resource */binding.imageContainer.setImageBitmap(bitmap)// Set color mode of the activity to the correct color mode.requireActivity().window.colorMode=if(bitmap.hasGainmap())ActivityInfo.COLOR_MODE_HDRelseActivityInfo.COLOR_MODE_DEFAULT
Java
finalBitmapbitmap=/* Get Bitmap from Image Resource */binding.imageContainer.setImageBitmap(bitmap);// Set color mode of the activity to the correct color mode.intcolorMode=ActivityInfo.COLOR_MODE_DEFAULT;if(bitmap.hasGainmap())colorMode=ActivityInfo.COLOR_MODE_HDR;requireActivity().getWindow().setColorMode(colorMode);
Ek kaynaklar
Ultra HDR resimler hakkında daha fazla bilgi edinmek için aşağıdaki ek kaynaklara bakın:
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-08-27 UTC.
[null,null,["Son güncelleme tarihi: 2025-08-27 UTC."],[],[],null,["# Display Ultra HDR images\n\nThe [Ultra HDR image format](/guide/topics/media/platform/hdr-image-format) lets images store more information\nabout the intensity of light, resulting in more detailed highlights and shadows,\nand more intense colors. Android provides support for Ultra HDR images beginning\nwith Android 14 (API level 34). If your app is running on those versions, it's\nimportant to configure your app to display these images properly. On the other\nhand, if your app isn't displaying Ultra HDR images, you can save device\nresources by not enabling Ultra HDR display. This page explains how to check\nwhether graphics support Ultra HDR, and how to display them properly.\n\nCheck for the presence of a gain map\n------------------------------------\n\nUltra HDR images contain a [*gain map*](/guide/topics/media/platform/hdr-image-format#gain_map-generation). The gain map is\nused to determine the increased brightness of each pixel in the image. To verify\nif an image is in the Ultra HDR format, convert the image or drawable into a\n[`Bitmap`](/reference/android/graphics/Bitmap) and call [`Bitmap.hasGainMap()`](/reference/android/graphics/Bitmap#hasGainmap())\n(available since Android 14) to check if it has a gain map.\n\nConfigure your window to display Ultra HDR\n------------------------------------------\n\nTo display Ultra HDR images with the full dynamic range, set the window's color\nmode to [`ActivityInfo.COLOR_MODE_HDR`](/reference/android/content/pm/ActivityInfo#COLOR_MODE_HDR). Do this by calling the\nwindow's [`setColorMode()`](/reference/android/view/Window#setColorMode(int)) method. (These APIs are\navailable from Android 8; however, images are not displayed in Ultra HDR unless\nthe device is running Android 14 or higher.)\n| **Note:** You can set a window's color mode in the Android manifest, but we don't recommend doing this. For optimum device performance, you should dynamically change a window's color mode to HDR when you're displaying an Ultra HDR image.\n| **Note:** Android takes screenshots in SDR. HDR content is tonemapped to SDR in screenshots.\n\nPutting it all together\n-----------------------\n\nThe following code shows how the whole process looks. This code assumes an image\nis loaded into a Bitmap, and checks if the image has a gain map. If it does, the\ncode switches the window's color mode to [`COLOR_MODE_HDR`](/reference/android/content/pm/ActivityInfo#COLOR_MODE_HDR). If\nthe image does not have a gain map, the code switches the window to the default\ncolor mode. \n\n### Kotlin\n\n```kotlin\nval bitmap = /* Get Bitmap from Image Resource */\nbinding.imageContainer.setImageBitmap(bitmap)\n\n// Set color mode of the activity to the correct color mode.\nrequireActivity().window.colorMode =\n if (bitmap.hasGainmap()) ActivityInfo.COLOR_MODE_HDR else ActivityInfo.COLOR_MODE_DEFAULT\n```\n\n### Java\n\n```java\nfinal Bitmap bitmap = /* Get Bitmap from Image Resource */\nbinding.imageContainer.setImageBitmap(bitmap);\n\n// Set color mode of the activity to the correct color mode.\nint colorMode = ActivityInfo.COLOR_MODE_DEFAULT;\nif (bitmap.hasGainmap()) colorMode = ActivityInfo.COLOR_MODE_HDR;\nrequireActivity().getWindow().setColorMode(colorMode);\n```\n\nAdditional resources\n--------------------\n\nTo learn more about Ultra HDR images, see the following additional resources:\n\n- Video: [Creating high-quality Android media\n experiences](https://www.youtube.com/watch?v=sv9ICtooWBc&t=284s)\n- Sample app: [Displaying Ultra HDR](https://github.com/android/platform-samples/blob/main/samples/graphics/ultrahdr/src/main/java/com/example/platform/graphics/ultrahdr/display/DisplayingUltraHDR.kt)\n- [Ultra HDR image format specification](/guide/topics/media/platform/hdr-image-format)\n- Video: [Android Developer Story: Instagram's early adoption of Ultra HDR transforms UX in only 3 months](https://www.youtube.com/watch?v=gGFHVi3NPWM)"]]