コード例 #1
0
            public void TestSave()
            {
                string            desc   = "this is an example description";
                string            desc2  = "\x00a9 Novell Inc.";
                PixbufOrientation orient = PixbufOrientation.TopRight;

                Gdk.Pixbuf test = new Gdk.Pixbuf(null, "f-spot-32.png");
                string     path = ImageFile.TempPath("joe.jpg");

                PixbufUtils.SaveJpeg(test, path, 75, new Exif.ExifData());
                JpegFile jimg = new JpegFile(path);

                jimg.SetDescription(desc);
                jimg.SetOrientation(orient);
                jimg.SaveMetaData(path);
                JpegFile mod = new JpegFile(path);

                Assert.AreEqual(mod.Orientation, orient);
                Assert.AreEqual(mod.Description, desc);
                jimg.SetDescription(desc2);
                jimg.SaveMetaData(path);
                mod = new JpegFile(path);
                Assert.AreEqual(mod.Description, desc2);

                File.Delete(path);
            }
コード例 #2
0
    public void WriteMetadataToImage()
    {
        string path = this.DefaultVersionUri.LocalPath;

        using (FSpot.ImageFile img = FSpot.ImageFile.Create(DefaultVersionUri)) {
            if (img is FSpot.JpegFile)
            {
                FSpot.JpegFile jimg = img as FSpot.JpegFile;

                jimg.SetDescription(this.Description);
                jimg.SetDateTimeOriginal(this.Time.ToLocalTime());
                jimg.SetXmp(UpdateXmp(this, jimg.Header.GetXmp()));

                jimg.SaveMetaData(path);
            }
            else if (img is FSpot.Png.PngFile)
            {
                FSpot.Png.PngFile png = img as FSpot.Png.PngFile;

                if (img.Description != this.Description)
                {
                    png.SetDescription(this.Description);
                }

                png.SetXmp(UpdateXmp(this, png.GetXmp()));

                png.Save(path);
            }
        }
    }
コード例 #3
0
        public string CreateFile()
        {
            Gdk.Pixbuf        test   = new Gdk.Pixbuf(null, "f-spot-32.png");
            string            path   = FSpot.ImageFile.TempPath("joe.jpg");
            string            desc   = "\x00a9 Novell Inc.";
            PixbufOrientation orient = PixbufOrientation.TopRight;

            PixbufUtils.SaveJpeg(test, path, quality, new Exif.ExifData());
            FSpot.JpegFile jimg = new FSpot.JpegFile(path);
            jimg.SetDescription(desc);
            jimg.SetOrientation(orient);
            jimg.SaveMetaData(path);

            return(path);
        }
コード例 #4
0
		public void Save ()
		{
			string desc = "this is an example description";
			string desc2 = "\x00a9 Novell Inc.";
			PixbufOrientation orient = PixbufOrientation.TopRight;
			Gdk.Pixbuf test = new Gdk.Pixbuf (null, "f-spot-32.png");
			string path = ImageFile.TempPath ("joe.jpg");
			
			PixbufUtils.SaveJpeg (test, path, 75, new Exif.ExifData ());
			JpegFile jimg = new JpegFile (path);
			jimg.SetDescription (desc);
			jimg.SetOrientation (orient);
			jimg.SaveMetaData (path);
			JpegFile mod = new JpegFile (path);
			Assert.AreEqual (mod.Orientation, orient);
			Assert.AreEqual (mod.Description, desc);
			jimg.SetDescription (desc2);
			jimg.SaveMetaData (path);
			mod = new JpegFile (path);
			Assert.AreEqual (mod.Description, desc2);
			
			Header header = mod.ExifHeader;
#if USE_TEST_FILE
			string tmp = "/home/lewing/test.tiff";
			if (File.Exists (tmp))
				File.Delete (tmp);
			Stream stream = File.Open (tmp, FileMode.Create, FileAccess.ReadWrite);
			Console.WriteLine ("XXXX saving tiff {0}", tmp);
#else
			System.IO.MemoryStream stream = new System.IO.MemoryStream ();
#endif

			header.Dump ("source");
			header.Save (stream);
			stream.Position = 0;
			System.Console.WriteLine ("----------------------------------------------LOADING TIFF");
			Header loader = new Header (stream);
			loader.Dump ("loader");
			
			CompareDirectories (header.Directory, loader.Directory);

			System.IO.File.Delete (path);	
		}
コード例 #5
0
ファイル: JpegHeader.cs プロジェクト: ArsenShnurkov/beagle-1
		public string CreateFile ()
		{
			Gdk.Pixbuf test = new Gdk.Pixbuf (null, "f-spot-32.png");
			string path = FSpot.ImageFile.TempPath ("joe.jpg");
			string desc = "\x00a9 Novell Inc.";
			PixbufOrientation orient = PixbufOrientation.TopRight;

			PixbufUtils.SaveJpeg (test, path, quality, new Exif.ExifData ());
			FSpot.JpegFile jimg = new FSpot.JpegFile (path);
			jimg.SetDescription (desc);
			jimg.SetOrientation (orient);
			jimg.SaveMetaData (path);
			
			return path;
		}
コード例 #6
0
			public void TestSave ()
			{
				string desc = "this is an example description";
				string desc2 = "\x00a9 Novell Inc.";
				PixbufOrientation orient = PixbufOrientation.TopRight;
				Gdk.Pixbuf test = new Gdk.Pixbuf (null, "f-spot-32.png");
				string path = ImageFile.TempPath ("joe.jpg");
				
				PixbufUtils.SaveJpeg (test, path, 75, new Exif.ExifData ());
				JpegFile jimg = new JpegFile (path);
				jimg.SetDescription (desc);
				jimg.SetOrientation (orient);
				jimg.SaveMetaData (path);
				JpegFile mod = new JpegFile (path);
				Assert.AreEqual (mod.Orientation, orient);
				Assert.AreEqual (mod.Description, desc);
				jimg.SetDescription (desc2);
				jimg.SaveMetaData (path);
				mod = new JpegFile (path);
				Assert.AreEqual (mod.Description, desc2);
				
				File.Delete (path);
			}