예제 #1
0
            // Methods

            /// <summary>
            /// Save the <see cref="ImageTexture"/> on a image file in the <see cref="OutputFolder"/> with <see cref="ImageFilename"/> as filename.
            /// </summary>
            public virtual void Save()
            {
                if (ImageFilename == null || ImageFilename.Length == 0)
                {
                    ImageFilename = ArucoObject.GenerateName() + ".png";
                }

                string outputFolderPath = Path.Combine((Application.isEditor) ? Application.dataPath : Application.persistentDataPath, OutputFolder);

                if (!Directory.Exists(outputFolderPath))
                {
                    Directory.CreateDirectory(outputFolderPath);
                }

                string imageFilePath = outputFolderPath + ImageFilename;

                File.WriteAllBytes(imageFilePath, ImageTexture.EncodeToPNG());
            }