# ImageDecoder.Source

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Source

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/graphics/ImageDecoder.Source "View this page in Java")  

```
abstract class Source
```

|---|------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                               ||
| ↳ | [android.graphics.ImageDecoder.Source](https://developer.android.com/reference/kotlin/android/graphics/ImageDecoder.Source#) |

Source of encoded image data.

References the data that will be used to decode a[Drawable](https://developer.android.com/reference/kotlin/android/graphics/drawable/Drawable)or[Bitmap](https://developer.android.com/reference/kotlin/android/graphics/Bitmap)in #decodeDrawable or #decodeBitmap. Constructing a`Source`(with one of the overloads of`createSource`) can be done on any thread because the construction simply captures values. The real work is done in #decodeDrawable or #decodeBitmap.

A`Source`object can be reused to create multiple versions of the same image. For example, to decode a full size image and its thumbnail, the same`Source`can be used once with no[OnHeaderDecodedListener](https://developer.android.com/reference/kotlin/android/graphics/ImageDecoder.OnHeaderDecodedListener)and once with an implementation of[onHeaderDecoded](https://developer.android.com/reference/kotlin/android/graphics/ImageDecoder.OnHeaderDecodedListener#onHeaderDecoded(android.graphics.ImageDecoder,%20android.graphics.ImageDecoder.ImageInfo,%20android.graphics.ImageDecoder.Source))that calls[setTargetSize](https://developer.android.com/reference/kotlin/android/graphics/ImageDecoder#setTargetSize(kotlin.Int,%20kotlin.Int))with smaller dimensions. One`Source`can even be used simultaneously in multiple threads.

## Summary