tiffcvt() 공개 메소드

public tiffcvt ( Tiff inImage, Tiff outImage ) : bool
inImage BitMiracle.LibTiff.Classic.Tiff
outImage BitMiracle.LibTiff.Classic.Tiff
리턴 bool
예제 #1
0
        public static void Main(string[] args)
        {
            Converter c = new Converter();
            c.m_testFriendly = g_testFriendly;

            int argn = 0;
            for (; argn < args.Length; argn++)
            {
                string arg = args[argn];
                if (arg[0] != '-')
                    break;

                string optarg = null;
                if (argn < (args.Length - 1))
                    optarg = args[argn + 1];

                arg = arg.Substring(1);
                switch (arg[0])
                {
                    case 'b':
                        c.m_processByBlock = true;
                        break;

                    case 'c':
                        if (optarg == "none")
                            c.m_compression = Compression.NONE;
                        else if (optarg == "packbits")
                            c.m_compression = Compression.PACKBITS;
                        else if (optarg == "lzw")
                            c.m_compression = Compression.LZW;
                        else if (optarg == "jpeg")
                            c.m_compression = Compression.JPEG;
                        else if (optarg == "zip")
                            c.m_compression = Compression.DEFLATE;
                        else
                        {
                            usage();
                            return;
                        }

                        argn++;
                        break;

                    case 'r':
                    case 't':
                        c.m_rowsPerStrip = int.Parse(optarg, CultureInfo.InvariantCulture);
                        argn++;
                        break;

                    case 'n':
                        c.m_noAlpha = true;
                        break;

                    case '?':
                        usage();
                        return;
                }
            }

            if (args.Length - argn < 2)
            {
                usage();
                return;
            }

            using (Tiff outImage = Tiff.Open(args[args.Length - 1], "w"))
            {
                if (outImage == null)
                    return;

                for (; argn < args.Length - 1; argn++)
                {
                    using (Tiff inImage = Tiff.Open(args[argn], "r"))
                    {
                        if (inImage == null)
                            return;

                        do
                        {
                            if (!c.tiffcvt(inImage, outImage) || !outImage.WriteDirectory())
                                return;
                        } while (inImage.ReadDirectory());
                    }
                }
            }
        }
예제 #2
0
        public static void Main(string[] args)
        {
            Converter c = new Converter();

            c.m_testFriendly = g_testFriendly;

            int argn = 0;

            for (; argn < args.Length; argn++)
            {
                string arg = args[argn];
                if (arg[0] != '-')
                {
                    break;
                }

                string optarg = null;
                if (argn < (args.Length - 1))
                {
                    optarg = args[argn + 1];
                }

                arg = arg.Substring(1);
                switch (arg[0])
                {
                case 'b':
                    c.m_processByBlock = true;
                    break;

                case 'c':
                    switch (optarg)
                    {
                    case "none":
                        c.m_compression = Compression.NONE;
                        break;

                    case "packbits":
                        c.m_compression = Compression.PACKBITS;
                        break;

                    case "lzw":
                        c.m_compression = Compression.LZW;
                        break;

                    case "jpeg":
                        c.m_compression = Compression.JPEG;
                        break;

                    case "zip":
                        c.m_compression = Compression.DEFLATE;
                        break;

                    default:
                        usage();
                        return;
                    }

                    argn++;
                    break;

                case 'r':
                case 't':
                    c.m_rowsPerStrip = int.Parse(optarg, CultureInfo.InvariantCulture);
                    argn++;
                    break;

                case 'n':
                    c.m_noAlpha = true;
                    break;

                case '?':
                    usage();
                    return;
                }
            }

            if (args.Length - argn < 2)
            {
                usage();
                return;
            }

            using (Tiff outImage = Tiff.Open(args[args.Length - 1], "w"))
            {
                if (outImage == null)
                {
                    return;
                }

                for (; argn < args.Length - 1; argn++)
                {
                    using (Tiff inImage = Tiff.Open(args[argn], "r"))
                    {
                        if (inImage == null)
                        {
                            return;
                        }

                        do
                        {
                            if (!c.tiffcvt(inImage, outImage) || !outImage.WriteDirectory())
                            {
                                return;
                            }
                        } while (inImage.ReadDirectory());
                    }
                }
            }
        }