Esempio n. 1
0
        public void Save(Stream stream)
        {
            using (var tiffStream = new TiffStreamWriter(forceBigEndian: IsBigEndian))
            {
                WriteTo(tiffStream);


                tiffStream.Seek(0, SeekOrigin.Begin);
                tiffStream.CopyTo(stream);
            }
        }
Esempio n. 2
0
        public void Save(string fileName)
        {
            using (var tiffStream = new TiffStreamWriter(forceBigEndian: IsBigEndian))
            {
                WriteTo(tiffStream);

                using (var stream = new FileStream(fileName, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.Read))
                {
                    tiffStream.Seek(0, SeekOrigin.Begin);
                    tiffStream.CopyTo(stream);
                }
            }
        }
Esempio n. 3
0
        void WriteTo(TiffStreamWriter tiffStream)
        {
            tiffStream.WriteHeader();
            tiffStream.WriteDWord(8); // IFD0 will always be immediately after the header, at offset 0x08
            uint previousOffset = 0;

            foreach (var image in Images)
            {
                var imageOffset = WriteImage(image, tiffStream);

                // update the pointer from the previous image, then seek back to the current offset
                if (previousOffset != 0)
                {
                    tiffStream.UpdateIFDPointer(previousOffset, imageOffset);
                    tiffStream.Seek(imageOffset, SeekOrigin.Begin);
                }

                previousOffset = imageOffset;
            }
        }