<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Heck's  Blog]]></title> 
<link>https://www.heckjj.com/index.php</link> 
<description><![CDATA[一瞬间的决定，往往可以改变很多，事实上，让自己成功的往往不是知识，是精神！ 如果你总是为自己找借口，那只好让成功推迟。执行力，今天！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Heck's  Blog]]></copyright>
<item>
<link>https://www.heckjj.com/java-read-jpeg-exif/</link>
<title><![CDATA[Java读取JPEG文件的exif信息]]></title> 
<author>Heck &lt;@hecks.tk&gt;</author>
<category><![CDATA[Web开发]]></category>
<pubDate>Fri, 10 Sep 2010 04:15:55 +0000</pubDate> 
<guid>https://www.heckjj.com/java-read-jpeg-exif/</guid> 
<description>
<![CDATA[ 
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family: 微软雅黑;">最近突然有个项目要用Java 读取 JPEG文件的信息， 宽度， 高度， 颜色表示等信息。 <br/>下载了一个工具jar 包 metadata-extractor-2.3.1.jar ， 网上搜一下 放到lib 里面。 <br/>一个简单的类来读取信息<br/>ReadFileProperties.java<br/></span><textarea name="code" class="java" rows="15" cols="100"> 
package com.founder.readfile; 
import java.io.File; 
import java.util.Iterator; 
import com.drew.imaging.jpeg.JpegMetadataReader; 
import com.drew.metadata.Directory; 
import com.drew.metadata.Metadata; 
import com.drew.metadata.Tag; 
import com.drew.metadata.exif.ExifDirectory; 

public class ReadFileProperties &#123; 
public static void main(String[] args) throws Exception &#123; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;File jpegFile = new File("E:/pic/LOGO.jpg"); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Metadata metadata = JpegMetadataReader.readMetadata(jpegFile); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Directory exif = metadata.getDirectory(ExifDirectory.class); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Iterator tags = exif.getTagIterator(); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// print color space 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(exif.containsTag(ExifDirectory.TAG_COLOR_SPACE))&#123; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("color space = " +&nbsp;&nbsp;exif.getDescription(ExifDirectory.TAG_COLOR_SPACE)); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//print all exif metadata 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while (tags.hasNext()) &#123; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tag tag = (Tag)tags.next(); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(tag.getTagType() + "====>" +tag); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125; 
&nbsp;&nbsp;&nbsp;&nbsp;&#125; 
&#125; </textarea><br/><span style="font-family: 微软雅黑;">记下来做个备忘。</span> <br/><br/>Tags - <a href="https://www.heckjj.com/tags/java/" rel="tag">java</a> , <a href="https://www.heckjj.com/tags/jpeg/" rel="tag">jpeg</a> , <a href="https://www.heckjj.com/tags/exif/" rel="tag">exif</a>
]]>
</description>
</item><item>
<link>https://www.heckjj.com/java-read-jpeg-exif/#blogcomment</link>
<title><![CDATA[[评论] Java读取JPEG文件的exif信息]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://www.heckjj.com/java-read-jpeg-exif/#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>