//returns an encoder based on image type
        public static ImageEncoder GetEncoderFromType(ImageType type)
        {
            ImageEncoder encoder = null;

            switch (type)
            {
            case ImageType.Jpeg:
                encoder = new JpegEncoder();
                break;

            case ImageType.Png:
                encoder = new PngEncoder();
                break;

            case ImageType.J2k:
                encoder = new Jp2Encoder();
                break;

            case ImageType.Bmp:
                encoder = new BmpEncoder();
                break;

            case ImageType.Emf:
                encoder = new EmfEncoder();
                break;

            case ImageType.Gif:
                encoder = new GifEncoder();
                break;

            case ImageType.Pcx:
                encoder = new PcxEncoder();
                break;

            case ImageType.Psd:
                encoder = new PsdEncoder();
                break;

            case ImageType.Tga:
                encoder = new TgaEncoder();
                break;

            case ImageType.Tiff:
                encoder = new TiffEncoder();
                break;

            case ImageType.Wbmp:
                encoder = new WbmpEncoder();
                break;

            case ImageType.Wmf:
                encoder = new WmfEncoder();
                break;

            case ImageType.Tla:
                encoder = new TlaEncoder();
                break;

            default:
                MessageBox.Show("当前的图像格式不支持");
                break;
            }

            return(encoder);
        }
        //returns an encoder based on image type
        public static ImageEncoder GetEncoderFromType( ImageType type )
        {
            ImageEncoder encoder = null;
            switch ( type )
            {
                case ImageType.Jpeg:
                    encoder = new JpegEncoder();
                    break;
                case ImageType.Png:
                    encoder = new PngEncoder();
                    break;
				case ImageType.J2k:
					encoder = new Jp2Encoder();
					break;
                case ImageType.Bmp:
                    encoder = new BmpEncoder();
                    break;
                case ImageType.Emf:
                    encoder = new EmfEncoder();
                    break;
                case ImageType.Gif:
                    encoder = new GifEncoder();
                    break;
                case ImageType.Pcx:
                    encoder = new PcxEncoder();
                    break;
                case ImageType.Psd:
                    encoder = new PsdEncoder();
                    break;
                case ImageType.Tga:
                    encoder = new TgaEncoder();
                    break;
                case ImageType.Tiff:
                    encoder = new TiffEncoder();
                    break;
                case ImageType.Wbmp:
                    encoder = new WbmpEncoder();
                    break;
                case ImageType.Wmf:
                    encoder = new WmfEncoder();
                    break;
                case ImageType.Tla:
                    encoder = new TlaEncoder();
                    break;
                default:
                    MessageBox.Show( "当前的图像格式不支持" );
                    break;
            }

            return encoder;
        }