久久天天躁狠狠躁夜夜免费观看,精品国产粉嫩内射白浆内射双马尾,久久国产欧美日韩精品,久久久久久性高,激情欧美成人久久综合

Java 獲取圖片屬性、獲取圖片EXIF屬性操作方法[metadata-extractor]

JSON 2019-07-27 18:49:02 17920

本站之前開發(fā)了圖片的一系列操作和查看工具,包括屬性查看,圖片轉(zhuǎn)換等等,依賴了別人的一些API,目前需要改成自己的API。


來查看這些上圖的圖片文件對應(yīng)的屬性:

依賴Jar包,metadata-extractor

github下載鏈接:https://github.com/drewnoakes/metadata-extractor/releases/tag/2.12.0

Maven 引入:

<dependency>
  <groupId>com.drewnoakes</groupId>
  <artifactId>metadata-extractor</artifactId>
  <version>2.12.0</version>
</dependency>

Gradle Groovy DSL

implementation 'com.drewnoakes:metadata-extractor:2.12.0'

Gradle Kotlin DSL

compile("com.drewnoakes:metadata-extractor:2.12.0")

其他查看這:https://search.maven.org/artifact/com.drewnoakes/metadata-extractor/2.12.0/jar

圖片屬性查看代碼

//獲取該圖片文件
        File file = new File("/Users/zhoubocheng/Downloads/IMG_2294.JPG");

        Metadata metadata = JpegMetadataReader.readMetadata(file);
        //輸出所有附加屬性數(shù)據(jù)
        for (Directory directory : metadata.getDirectories()) {
            System.out.println("屬性組:" + directory.getName());
            for (Tag tag : directory.getTags()) {
               String kv =  String.format("%s = %s",tag.getTagName(),tag.getDescription());
                System.out.println(kv);
            }
        }

查看圖片EXIF信息

注意需要手機或者相機等直接拍照的圖片,剪切圖,PS圖等等部分信息是缺失的。

//獲取EXIF信息,用直接相機或者手機拍出來的圖片來做獲取,剪切圖或者操作過裁剪大部分信息是讀取不到的
        System.out.println("++++++++++++++++++ EXIF ++++++++++++++++++++");

        ExifIFD0Directory exif = metadata.getFirstDirectoryOfType(ExifIFD0Directory.class);
        if(null != exif){
            //循環(huán)輸出
            exif.getTags().forEach(System.out::println);

            if(exif.containsTag(ExifIFD0Directory.TAG_MAKE)){
                System.out.println("Make:" + exif.getDescription(ExifIFD0Directory.TAG_MAKE));
            }
        }


        System.out.println("ExifSubIFDDirectory:");
        Directory exifSub = metadata.getFirstDirectoryOfType(ExifSubIFDDirectory.class);
        if(null != exifSub){
            //循環(huán)輸出
            exifSub.getTags().forEach(System.out::println);
        }

        System.out.println("ExifInteropDirectory:");
        Directory exifInterop = metadata.getFirstDirectoryOfType(ExifInteropDirectory.class);
        if(null != exifInterop){
            //循環(huán)輸出
            exifInterop.getTags().forEach(System.out::println);
        }

        System.out.println("ExifThumbnailDirectory:");
        Directory exifThumbnail = metadata.getFirstDirectoryOfType(ExifThumbnailDirectory.class);
        if(null != exifThumbnail){
            //循環(huán)輸出
            exifThumbnail.getTags().forEach(System.out::println);
        }

整體內(nèi)容輸出:

屬性組:JPEG
Compression Type = Baseline
Data Precision = 8 bits
Image Height = 3024 pixels
Image Width = 4032 pixels
Number of Components = 3
Component 1 = Y component: Quantization table 0, Sampling factors 2 horiz/2 vert
Component 2 = Cb component: Quantization table 1, Sampling factors 1 horiz/1 vert
Component 3 = Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert
屬性組:Exif IFD0
Orientation = Top, left side (Horizontal / normal)
X Resolution = 72 dots per inch
Y Resolution = 72 dots per inch
Resolution Unit = Inch
YCbCr Positioning = Center of pixel array
屬性組:Exif SubIFD
Exif Version = 2.21
Components Configuration = YCbCr
FlashPix Version = 1.00
Color Space = sRGB
Exif Image Width = 4032 pixels
Exif Image Height = 3024 pixels
Scene Capture Type = Standard
屬性組:Exif Thumbnail
Compression = JPEG (old-style)
X Resolution = 72 dots per inch
Y Resolution = 72 dots per inch
Resolution Unit = Inch
Thumbnail Offset = 286 bytes
Thumbnail Length = 9220 bytes
屬性組:ICC Profile
Profile Size = 548
CMM Type = appl
Version = 4.0.0
Class = Display Device
Color space = RGB 
Profile Connection Space = XYZ 
Profile Date/Time = 2017:07:07 13:22:32
Signature = acsp
Primary Platform = Apple Computer, Inc.
Device manufacturer = APPL
XYZ values = 0.964 1 0.825
Tag Count = 10
Profile Description = Display P3
Copyright = Copyright Apple Inc., 2017
Media White Point = (0.9505, 1, 1.0891)
Red Colorant = (0.5151, 0.2412, 65536)
Green Colorant = (0.292, 0.6922, 0.0419)
Blue Colorant = (0.1571, 0.0666, 0.7841)
Red TRC = para (0x70617261): 32 bytes
Chromatic Adaptation = sf32 (0x73663332): 44 bytes
Blue TRC = para (0x70617261): 32 bytes
Green TRC = para (0x70617261): 32 bytes
屬性組:Huffman
Number of Tables = 4 Huffman tables
屬性組:File
File Name = IMG_2294.JPG
File Size = 2853337 bytes
File Modified Date = 星期三 七月 24 10:54:38 +08:00 2019
++++++++++++++++++ EXIF ++++++++++++++++++++
[Exif IFD0] Orientation - Top, left side (Horizontal / normal)
[Exif IFD0] X Resolution - 72 dots per inch
[Exif IFD0] Y Resolution - 72 dots per inch
[Exif IFD0] Resolution Unit - Inch
[Exif IFD0] YCbCr Positioning - Center of pixel array
ExifSubIFDDirectory:
[Exif SubIFD] Exif Version - 2.21
[Exif SubIFD] Components Configuration - YCbCr
[Exif SubIFD] FlashPix Version - 1.00
[Exif SubIFD] Color Space - sRGB
[Exif SubIFD] Exif Image Width - 4032 pixels
[Exif SubIFD] Exif Image Height - 3024 pixels
[Exif SubIFD] Scene Capture Type - Standard
ExifInteropDirectory:
ExifThumbnailDirectory:
[Exif Thumbnail] Compression - JPEG (old-style)
[Exif Thumbnail] X Resolution - 72 dots per inch
[Exif Thumbnail] Y Resolution - 72 dots per inch
[Exif Thumbnail] Resolution Unit - Inch
[Exif Thumbnail] Thumbnail Offset - 286 bytes
[Exif Thumbnail] Thumbnail Length - 9220 bytes


版權(quán)所屬:SO JSON在線解析

原文地址:http://suancuo.cn/blog/339.html

轉(zhuǎn)載時必須以鏈接形式注明原始出處及本聲明。

本文主題:

如果本文對你有幫助,那么請你贊助我,讓我更有激情的寫下去,幫助更多的人。

關(guān)于作者
一個低調(diào)而悶騷的男人。
相關(guān)文章
Java 獲取時間戳的方法大全,以及速度比較
Java獲取域名,Java從URL地址中獲取域名,Java從Request 獲取域名
根據(jù)域名獲取IP地址,Java 獲取域名的IP地址
Java 獲取webapp,Root,classpath,項目等路徑工具類
Java 正則獲取一級域名
Elasticsearch Java API 獲取version,以及數(shù)據(jù)_version的介紹
JSON格式講解,JSON獲取對象,JSONObject和JSONArray的操作
Java獲取重定向后的真實URL地址
Java百度云觀測對網(wǎng)站的檢測數(shù)據(jù),獲取子域名及域名的安全信息
HttpClient獲取訪問域名的真實ip,HttpClient請求獲取目標IP地址
最新文章
計算機網(wǎng)絡(luò)的相關(guān)內(nèi)容 857
SOJSON V6 JavaScript 解密技巧與分析 6158
微信客服人工電話95068:如何快速解封微信賬號(2025最新指南) 12343
Java Http請求,HttpURLConnection HTTP請求丟失頭信息,Head信息丟失解決方案 5097
實用API合集分享:教你輕松獲取IP地址的API合集 8951
Linux I/O重定向 6723
Ruby 循環(huán) - while、for、until、break、redo 和 retry 3996
Node.js:全局對象 3629
如何使用終端檢查Linux上的內(nèi)存使用情況 3779
JavaScript對象詳細剖析 3287
最熱文章
免費天氣API,天氣JSON API,不限次數(shù)獲取十五天的天氣預(yù)報 747527
最新MyEclipse8.5注冊碼,有效期到2020年 (已經(jīng)更新) 703557
蘋果電腦Mac怎么恢復(fù)出廠系統(tǒng)?蘋果系統(tǒng)怎么重裝系統(tǒng)? 678486
Jackson 時間格式化,時間注解 @JsonFormat 用法、時差問題說明 561963
我為什么要選擇RabbitMQ ,RabbitMQ簡介,各種MQ選型對比 511863
Elasticsearch教程(四) elasticsearch head 插件安裝和使用 483778
Jackson 美化輸出JSON,優(yōu)雅的輸出JSON數(shù)據(jù),格式化輸出JSON數(shù)據(jù)... ... 299671
Java 信任所有SSL證書,HTTPS請求拋錯,忽略證書請求完美解決 246723
Elasticsearch教程(一),全程直播(小白級別) 232174
227553
支付掃碼

所有贊助/開支都講公開明細,用于網(wǎng)站維護:贊助名單查看

查看我的收藏

正在加載... ...