public PlantLifeImagesService()
        {
            //Bitmap bmONE =  getImageFromFile("images/butterfly/animated-butterfly-image-0005.gif");
            PlantLifeImage pli = new PlantLifeImage();
            //pli.PlantImage = getImageFromFile("images\\zone2\\sh-57sec-slow.gif");
            //pli.PlantImage = getImageFromFile("images\\fade\\sh-trans-colorized.gif");
            // default value
            pli.PlantImage = getImageFromFile("images\\butterfly3\\butterflies6.gif");
            plantLifeImagesOver.Add(pli);

            //loadMovie("images/zone3/z2brightcolors10fr25.mov"); // load background complex as .mov frame by frame.
            //loadMovie("z2 bright colors.mov");
            loadImages("images/welcome");
            loadOverlayImages(); // use default butterfly
            ZoneDef df1 = new ZoneDef();
            df1.Id = 0;
            df1.ZoneName = "welcome";
            df1.FrameSize = new Size(320, 210);
            df1.ImageDir = "images/welcome";
            df1.DistanceAway = 168;

            setupZoneDefs(df1);
        }
        public void loadOverlayImages(string targetDir = "images/butterfly")
        {
            Console.WriteLine("loadOverlayImages plant life loadImages");
            string[] files = Directory.GetFiles(targetDir, "*");
            foreach (var f in files)
            {
                PlantLifeImage plantLifeImage = new PlantLifeImage();
                plantLifeImage.PlantImage = getImageFromFile(f);
                plantLifeImage.ImageFileName = f;
                Console.Write("fn=" + f + " ");
                plantLifeImage.ImageName = f;
                plantLifeImage.ImageType = targetDir;
                Console.Write(" targetDir=" + targetDir + " ");
                plantLifeImagesOver.Add(plantLifeImage);

                FrameDimension dimension = new FrameDimension(plantLifeImage.PlantImage.FrameDimensionsList[0]);
                // Number of frames
                int frameCount = plantLifeImage.PlantImage.GetFrameCount(dimension);
                Console.WriteLine(" PlantImage.GetFrameCount=" + frameCount + " for file:" + f);
            }
        }
 /// <summary>
 /// targetDir is used for ImageType put types into custom directories and load for automatic categorization. 
 /// </summary>
 /// <param name="targetDir"></param>
 public void loadImages(string targetDir = "images")
 {
     Console.WriteLine("plant life loadImages targetDir="+targetDir);
     string[] files = Directory.GetFiles(targetDir, "*");
     foreach (var f in files)
     {
         PlantLifeImage plantLifeImage = new PlantLifeImage();
         plantLifeImage.PlantImage = getImageFromFile(f);
         plantLifeImage.ImageFileName = f;
         plantLifeImage.ImageName = f;
         plantLifeImage.ImageType = targetDir;
         plantLifeImages.Add(plantLifeImage);
     }
 }
        public void loadMovie(string movelocation = "images\\zone2\\0247 Painting photo JPEG.mov")
        {
            ProcessImageSequences processImageSeq = new ProcessImageSequences();
            processImageSeq.StartCapture();
            processImageSeq.processMovIntoImageArray();

            for (int x=0; x<processImageSeq.paintingJPEGMov.Count ; x++)
            {
                PlantLifeImage plantLifeImage = new PlantLifeImage();
                if (processImageSeq.paintingJPEGMov == null)
                    break;
                plantLifeImage.PlantImage = processImageSeq.paintingJPEGMov[x].ToBitmap();
                plantLifeImages.Add(plantLifeImage);
            }
        }
        public void initializeJSONFile()
        {
            PlantLifeImage pli = new PlantLifeImage();
            pli.DistanceAway = 10;
            pli.ImageFileName = "images/closer.jpg";
            pli.ImageName = "closer.jpg";
            pli.ImageType = "outdoor";
            pli.PlantLifeAnimationId = 1;
            pli.TimeOfDay = "any";

            List<PlantLifeImage> jPlantlifeimages = new List<PlantLifeImage>();
            JsonSerializer serializer = new JsonSerializer();

            try
            {
                jPlantlifeimages.Add(pli);
                using (StreamWriter sw = new StreamWriter(@"model/images.txt"))
                using (JsonWriter writer = new JsonTextWriter(sw))
                {
                    serializer.Serialize(writer, jPlantlifeimages);
                }
            }
            catch(Exception errInit)
            {
                Console.WriteLine("initializeJSONFile ERROR = " + errInit);
            }
        }