예제 #1
0
        public Dictionary <string, object> metaInfo()
        {
            ExifParser exifParser;
            Dictionary <string, object> tiff, exif, gps, thumb, meta;

            List <byte[]> headers = getHeaders("app1");

            meta = new Dictionary <string, object>();

            try
            {
                if (headers.Count != 0)
                {
                    exifParser = new ExifParser();
                    if (exifParser.init(headers[0]))
                    {
                        tiff = exifParser.TIFF();
                        if (tiff != null)
                        {
                            meta.Add("tiff", tiff);
                        }

                        exif = exifParser.EXIF();
                        if (exif != null)
                        {
                            meta.Add("exif", exif);
                        }

                        gps = exifParser.GPS();
                        if (gps != null)
                        {
                            meta.Add("gps", gps);
                        }

                        thumb = getThumb(exifParser);
                        if (thumb != null)
                        {
                            if (!thumb.ContainsKey("keys"))
                            {
                                string[] keys = new string[thumb.Keys.Count];
                                thumb.Keys.CopyTo(keys, 0);
                                thumb.Add("keys", keys);
                            }

                            meta.Add("thumb", thumb);
                        }

                        exifParser.purge();
                    }
                }
            } catch (Exception ex) {}
            return(meta);
        }
예제 #2
0
파일: JPEG.cs 프로젝트: defrex/moxie
        public void updateDimensions(int width, int height)
        {
            ExifParser    exifParser;
            List <byte[]> headers;

            headers = getHeaders("app1");

            if (headers.Count != 0)
            {
                exifParser = new ExifParser();
                if (exifParser.init(headers[0]))
                {
                    exifParser.setExif("PixelXDimension", width);
                    exifParser.setExif("PixelYDimension", height);

                    setHeaders("app1", exifParser.getBinary());
                }
                exifParser.purge();
            }
        }
예제 #3
0
 public Dictionary <string, object> getThumb(ExifParser exifParser)
 {
     byte[] thumb = exifParser.thumb();
     if (thumb != null)
     {
         BinaryReader             br        = new BinaryReader(new MemoryStream(thumb));
         Dictionary <string, int> thumbInfo = info(br);
         br.clear();
         if (thumbInfo != null)
         {
             return(new Dictionary <string, object>()
             {
                 { "width", thumbInfo["width"] },
                 { "height", thumbInfo["height"] },
                 { "data", thumb }
             });
         }
     }
     return(null);
 }
예제 #4
0
파일: JPEG.cs 프로젝트: defrex/moxie
        public Dictionary <string, object> metaInfo()
        {
            ExifParser exifParser;
            Dictionary <string, object> tiff, exif, gps, meta;

            List <byte[]> headers = getHeaders("app1");

            meta = new Dictionary <string, object>();

            if (headers.Count != 0)
            {
                exifParser = new ExifParser();
                if (exifParser.init(headers[0]))
                {
                    tiff = exifParser.TIFF();
                    if (tiff != null)
                    {
                        meta.Add("tiff", tiff);
                    }

                    exif = exifParser.EXIF();
                    if (exif != null)
                    {
                        meta.Add("exif", exif);
                    }

                    gps = exifParser.GPS();
                    if (gps != null)
                    {
                        meta.Add("gps", gps);
                    }

                    exifParser.purge();
                }
            }
            return(meta);
        }
예제 #5
0
파일: JPEG.cs 프로젝트: jacekelgda/moxie
        public void updateDimensions(int width, int height)
        {
            ExifParser exifParser;
            List<byte[]> headers;

            headers = getHeaders("exif");

            if (headers.Count != 0) {
                exifParser = new ExifParser();
                if (exifParser.init(headers[0])) {

                    exifParser.setExif("PixelXDimension", width);
                    exifParser.setExif("PixelYDimension", height);

                    setHeaders("exif", exifParser.getBinary());
                }
                exifParser.purge();
            }
        }
예제 #6
0
파일: JPEG.cs 프로젝트: jacekelgda/moxie
        public Dictionary<string, object> metaInfo()
        {
            ExifParser exifParser;
            Dictionary <string, object> tiff, exif, gps, meta;

            List<byte[]> headers = getHeaders("exif");
            meta = new Dictionary<string, object>();

            if (headers.Count != 0) {
                exifParser = new ExifParser();
                if (exifParser.init(headers[0])) {

                    tiff = exifParser.TIFF();
                    if (tiff != null) {
                        meta.Add("tiff", tiff);
                    }

                    exif = exifParser.EXIF();
                    if (exif != null) {
                        meta.Add("exif", exif);
                    }

                    gps = exifParser.GPS();
                    if (gps != null) {
                        meta.Add("gps", gps);
                    }

                    exifParser.purge();
                }
            }
            return meta;
        }
예제 #7
0
        public Dictionary<string, object> metaInfo()
        {
            ExifParser exifParser;
            Dictionary <string, object> tiff, exif, gps, thumb, meta;

            List<byte[]> headers = getHeaders("app1");
            meta = new Dictionary<string, object>();

            try
            {
                if (headers.Count != 0)
                {
                    exifParser = new ExifParser();
                    if (exifParser.init(headers[0]))
                    {

                        tiff = exifParser.TIFF();
                        if (tiff != null)
                        {
                            meta.Add("tiff", tiff);
                        }

                        exif = exifParser.EXIF();
                        if (exif != null)
                        {
                            meta.Add("exif", exif);
                        }

                        gps = exifParser.GPS();
                        if (gps != null)
                        {
                            meta.Add("gps", gps);
                        }

                        thumb = getThumb(exifParser);
                        if (thumb != null)
                        {
                            if (!thumb.ContainsKey("keys"))
                            {
                                string[] keys = new string[thumb.Keys.Count];
                                thumb.Keys.CopyTo(keys, 0);
                                thumb.Add("keys", keys);
                            }

                            meta.Add("thumb", thumb);
                        }

                        exifParser.purge();
                    }
                }
            } catch (Exception ex) {}
            return meta;
        }
예제 #8
0
 public Dictionary<string, object> getThumb(ExifParser exifParser)
 {
     byte[] thumb = exifParser.thumb();
     if (thumb != null)
     {
         BinaryReader br = new BinaryReader(new MemoryStream(thumb));
         Dictionary<string, int> thumbInfo = info(br);
         br.clear();
         if (thumbInfo != null)
         {
             return new Dictionary<string, object>()
             {
                 { "width", thumbInfo["width"] },
                 { "height", thumbInfo["height"] },
                 { "data", thumb }
             };
         }
     }
     return null;
 }