## Getting image data from Earth Engine


To get image data from Earth Engine to Google Drive, Cloud Storage, or an Earth Engine asset,
you can use [`Export`](https://developers.google.com/earth-engine/guides/exporting) and the job
is handled entirely by Earth Engine. If your export jobs have scaling issues (e.g.
take longer than a day, return memory or timeout errors) or you're already familiar
with a framework like [Apache Beam](https://beam.apache.org/),
[Spark](https://spark.apache.org/) or [Dask](https://www.dask.org/),
you may prefer the data extraction methods described here. Workflows implemented in these
frameworks can be scaled using Google Cloud tools such as
[Dataflow](https://cloud.google.com/dataflow) or
[Dataproc](https://cloud.google.com/dataproc).


Specifically, this guide describes methods for manually making requests
for image data using
[`getPixels`](https://developers.google.com/earth-engine/apidocs/ee-data-getpixels) or
[`computePixels`](https://developers.google.com/earth-engine/apidocs/ee-data-computepixels).
Here, "image data" means multi-dimensional arrays of pixel values with consistent
scale and projection. The region, scale, projection and/or dimensions are specified
in the request. The
[ImageFileFormat page](https://developers.google.com/earth-engine/reference/rest/v1/ImageFileFormat) lists
possible output formats. Output destinations include Cloud Storage or any locally mounted
directory. Manual requests add complexity, but can scale to larger workloads.

## Getting image data from existing assets

Use [`getPixels`](https://developers.google.com/earth-engine/apidocs/ee-data-getpixels)
to get image data from existing Earth Engine assets. You
pass the asset ID directly to the request, so you can't do any computation on the pixels
prior to extracting them. A block of pixels in the specified region, scale, projection
and format is returned. The following example demonstrates getting time series of NDVI
from a MODIS image collection using `getPixels`.

|---|---|
| [![Colab logo](https://developers.google.com/static/earth-engine/images/colab_logo_32px.png) Run in Google Colab](https://colab.research.google.com/github/google/earthengine-community/blob/master/guides/linked/Earth_Engine_training_patches_getPixels.ipynb) | [![GitHub logo](https://developers.google.com/static/earth-engine/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/google/earthengine-community/blob/master/guides/linked/Earth_Engine_training_patches_getPixels.ipynb) |

## Getting image data from computed images


Use [`computePixels`](https://developers.google.com/earth-engine/apidocs/ee-data-computepixels)
to get image data from a computed image, for example a composite. With
[`computePixels`](https://developers.google.com/earth-engine/apidocs/ee-data-computepixels),
you pass a computed `ee.Image` object through the `expression`
parameter. A block of computed pixels in the specified region, scale, projection and
format is returned. The following example shows getting patches of multispectral data
from a cloud-free Sentinel-2 composite.

|---|---|
| [![Colab logo](https://developers.google.com/static/earth-engine/images/colab_logo_32px.png) Run in Google Colab](https://colab.research.google.com/github/google/earthengine-community/blob/master/guides/linked/Earth_Engine_training_patches_computePixels.ipynb) | [![GitHub logo](https://developers.google.com/static/earth-engine/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/google/earthengine-community/blob/master/guides/linked/Earth_Engine_training_patches_computePixels.ipynb) |

## Manual parallelization of requests


Though you can make requests for any purpose in any volume, you may want to parallelize
requests for larger workflows. To make many such requests in parallel, you should use
the [Earth Engine high volume endpoint](https://developers.google.com/earth-engine/cloud/highvolume).
The number of parallel requests you can have is set by your
[concurrent
interactive request quota](https://developers.google.com/earth-engine/guides/usage#concurrent_interactive_requests). See the [Earth
Engine high volume page](https://developers.google.com/earth-engine/cloud/highvolume) for details on when to use the high volume endpoint.

### Multi-threading

You can use threads to make concurrrent requests. This approach is demonstrated in the
`getPixels` and `computePixels` example notebooks.

### Apache Beam


You can use [Apache Beam](https://beam.apache.org/) pipelines to parallelize
requests. These pipelines can be run locally or as Google Dataflow jobs. For examples, see
[this Geo for Good training](https://earthoutreachonair.withgoogle.com/events/geoforgood22?talk=day1-trackthree-talk2) or
[this People, Planet and AI demonstration](https://github.com/GoogleCloudPlatform/python-docs-samples/tree/main/people-and-planet-ai/land-cover-classification). Alternatively, other parallelization
libraries include [Dask](https://www.dask.org/) and
[Apache Spark](https://spark.apache.org/).