Intrinsic for converting an Android YUV buffer to RGB. The input allocation should be supplied in a supported YUV format as a YUV element Allocation. The output is RGBA; the alpha channel will be set to 255.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ScriptIntrinsicYuvToRGB\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nDeprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nScriptIntrinsicYuvToRGB\n=======================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/renderscript/ScriptIntrinsicYuvToRGB \"View this page in Java\") \n\n```\nclass ScriptIntrinsicYuvToRGB : ScriptIntrinsic\n```\n\n|---|---|---|---|---------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||||\n| ↳ | [android.renderscript.BaseObj](/reference/kotlin/android/renderscript/BaseObj) ||||\n| | ↳ | [android.renderscript.Script](/reference/kotlin/android/renderscript/Script) |||\n| | | ↳ | [android.renderscript.ScriptIntrinsic](/reference/kotlin/android/renderscript/ScriptIntrinsic) ||\n| | | | ↳ | [android.renderscript.ScriptIntrinsicYuvToRGB](#) |\n\n*** ** * ** ***\n\n| **This class was deprecated in API level 31.**\n|\n| Renderscript has been deprecated in API level 31. Please refer to the [migration guide](https://developer.android.com/guide/topics/renderscript/migration-guide) for the proposed alternatives.\n\nIntrinsic for converting an Android YUV buffer to RGB. The input allocation should be supplied in a supported YUV format as a YUV element Allocation. The output is RGBA; the alpha channel will be set to 255.\n\nSummary\n-------\n\n| Public methods ||\n|------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [ScriptIntrinsicYuvToRGB](#)! | [create](#create(android.renderscript.RenderScript,%20android.renderscript.Element))`(`rs:` `[RenderScript](/reference/kotlin/android/renderscript/RenderScript)!`, `e:` `[Element](/reference/kotlin/android/renderscript/Element)!`)` Create an intrinsic for converting YUV to RGB. |\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [forEach](#forEach(android.renderscript.Allocation))`(`aout:` `[Allocation](/reference/kotlin/android/renderscript/Allocation)!`)` Convert the image to RGB. |\n| [Script.FieldID](/reference/kotlin/android/renderscript/Script.FieldID)! | [getFieldID_Input](#getFieldID_Input())`()` Get a FieldID for the input field of this intrinsic. |\n| [Script.KernelID](/reference/kotlin/android/renderscript/Script.KernelID)! | [getKernelID](#getKernelID())`()` Get a KernelID for this intrinsic kernel. |\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setInput](#setInput(android.renderscript.Allocation))`(`ain:` `[Allocation](/reference/kotlin/android/renderscript/Allocation)!`)` Set the input yuv allocation, must be [Element.U8](/reference/kotlin/android/renderscript/Element#U8(android.renderscript.RenderScript)). |\n\nPublic methods\n--------------\n\n### create\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic fun create(\n rs: RenderScript!, \n e: Element!\n): ScriptIntrinsicYuvToRGB!\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nCreate an intrinsic for converting YUV to RGB. Supported elements types are [Element.U8_4](/reference/kotlin/android/renderscript/Element#U8_4(android.renderscript.RenderScript))\n\n| Parameters ||\n|------|------------------------------------------------------------------------------------------------|\n| `rs` | [RenderScript](/reference/kotlin/android/renderscript/RenderScript)!: The RenderScript context |\n| `e` | [Element](/reference/kotlin/android/renderscript/Element)!: Element type for output |\n\n| Return ||\n|-------------------------------|-------------------------|\n| [ScriptIntrinsicYuvToRGB](#)! | ScriptIntrinsicYuvToRGB |\n\n### forEach\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun forEach(aout: Allocation!): Unit\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nConvert the image to RGB.\n\n| Parameters ||\n|--------|------------------------------------------------------------------------------------------------------------------------|\n| `aout` | [Allocation](/reference/kotlin/android/renderscript/Allocation)!: Output allocation. Must match creation element type. |\n\n### getFieldID_Input\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getFieldID_Input(): Script.FieldID!\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nGet a FieldID for the input field of this intrinsic.\n\n| Return ||\n|--------------------------------------------------------------------------|------------------------------------|\n| [Script.FieldID](/reference/kotlin/android/renderscript/Script.FieldID)! | Script.FieldID The FieldID object. |\n\n### getKernelID\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getKernelID(): Script.KernelID!\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nGet a KernelID for this intrinsic kernel.\n\n| Return ||\n|----------------------------------------------------------------------------|--------------------------------------|\n| [Script.KernelID](/reference/kotlin/android/renderscript/Script.KernelID)! | Script.KernelID The KernelID object. |\n\n### setInput\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setInput(ain: Allocation!): Unit\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nSet the input yuv allocation, must be [Element.U8](/reference/kotlin/android/renderscript/Element#U8(android.renderscript.RenderScript)).\n\n| Parameters ||\n|-------|-----------------------------------------------------------------------------------------|\n| `ain` | [Allocation](/reference/kotlin/android/renderscript/Allocation)!: The input allocation. |"]]