public async void WriteImageFile(
            string filePath,
            int width,
            int height,
            float offsetElevation,
            Vector2 lerpElevation,
            System.Action onFinish = null
            )
        {
            //get file path from user:
            {
                if (filePath.Length == 0)
                {
                    Debug.Log("Cancelled by user");
                    return;
                }
                if (IO.File.Exists(filePath) == false)
                {
                    Debug.LogError($"File not found: { filePath }");
                    return;
                }
            }

            //prepare samples:
            Debug.Log($"Creating image...\nsource: { filePath }");
            ushort[] pixels;
            {
                pixels = new ushort[height * width];
                IO.FileStream   stream = null;
                IO.StreamReader reader = null;

                await Task.Run(() => {
                    try
                    {
                        stream = new IO.FileStream(
                            filePath,
                            IO.FileMode.Open,
                            IO.FileAccess.Read,
                            IO.FileShare.Read
                            );
                        reader = new IO.StreamReader(stream);

                        int index = 0;

                        //
                        string line = null;
                        while ((line = reader.ReadLine()) != null)
                        {
                            if (line.Length != 0)
                            {
                                //calc color value:
                                float elevation     = float.Parse(line) + offsetElevation;
                                float inverselerped = Mathf.InverseLerp(
                                    lerpElevation.x,
                                    lerpElevation.y,
                                    elevation
                                    );
                                ushort color = (ushort)(inverselerped * ushort.MaxValue);

                                // find pixel position
                                int X = (width - 1) - index % width;
                                int Y = (height - 1) - index / width;

                                // set pixel color
                                pixels[Y *width + X] = color;

                                //step
                                index++;
                            }
                        }
                    }
                    catch (System.Exception ex) { Debug.LogException(ex); }
                    finally
                    {
                        if (stream != null)
                        {
                            stream.Close();
                        }
                        if (reader != null)
                        {
                            reader.Close();
                        }
                    }
                });
            }

            //write bytes to file:
            {
                string pngFilePath = $"{ filePath.Replace(".csv","") } offset({ offsetElevation }) invlerp({ lerpElevation.x },{ lerpElevation.y }).png";
                Debug.Log($"\twriting to PNG file: { pngFilePath }");
                await PNG.WriteGrayscaleAsync(
                    pixels :    pixels,
                    width :      width,
                    height :     height,
                    alpha :      false,
                    filePath :   pngFilePath
                    );

                filePath = null;
                Debug.Log($"\tPNG file ready: { pngFilePath }");
            }

            //call on finish:
            if (onFinish != null)
            {
                onFinish();
            }
        }