So you are talking about RGB image, potentially it means an int GeoTiff.
The code looks like (current snapshot version 1.0.0-SNAPSHOT
):
val matrix: Array[Array[Int]] = ???
val cols = ??? // matrix dimensions
val rows = ???
val extent: Extent = ??? // you need extent for geotiff
val crs: CRS = ??? // you need to know crs
val tile = IntArrayTile.empty(cols, rows) // create an empty tile
for {
c <- 0 until cols
r <- 0 until rows
} tile.set(c, r, matrix(c)(r))
val geotiff = SinglebandGeoTiff(tile, extent, crs) // it's a geotiff
geotiff.write("dir where you plan to save your geotiff")
However it would be a grayscaled geotiff, to persist an RGB image you may want to create three tiles, and to save everything as a Multiband GeoTiff.
val red: Tile = ???
val green: Tile = ???
val blue: Tile = ???
val mbtile = MultibandTile(red, green, bule)
val mbgeotiff = new MultibandGeoTiff(
mbtile,
extent,
crs,
GeoTiffOptions(
Striped,
NoCompression,
ColorSpace.RGB
)
) // GeoTiff options setup is quite important, to set up `TIFFTAG_PHOTOMETRIC` tag
mbgeotiff.write("dir where you plan to save your geotiff")
But I am not familiar with Breeze
API, we can discuss your use case in a GeoTrellis gitter channel or / and to provide more information there.