When I import my image into ArcGIS Desktop I get a black border around the region that didn't exist before in Google Earth Engine (GEE).
How can I prevent GEE from doing this when I export an image?
I'm not sure why GEE adds a black border to exported images, I think it's something to do with the re-orienting the image to the new projection system and cannot be changed. This isn't an issue if you're exporting a satellite image raster, as it sets the border pixel values to class 0 and this doesn't interfere with the pixels in the rest of the image.
It's a bit of a pain when exporting a classified image that contains useful pixels that are classified as zero as this messes with the analysis. Anyway, I managed to figure it out with a simple .remap code. I just reassigned the values from class 0 onwards to the integer above, thus leaving class 0 free for noData pixels. Here is the code:
// Classified image with 5 classes (from cluster analysis)
var classified_image = cluster.cluster(clusterer);
// remap values in class to integer above so class 0 becomes free for noData pixels
var remap = ee.Image(classified_image)
.remap([0,1,2,3,4], [1,2,3,4,5]);
Export.image.toDrive({...
NoData Value = 0
and your GIS software will then interpret all 0 value pixels as No Data.