{"id":1684,"date":"2014-01-02T22:03:33","date_gmt":"2014-01-02T13:03:33","guid":{"rendered":"http:\/\/mattyan.net\/blog\/?p=1684"},"modified":"2014-01-02T22:03:33","modified_gmt":"2014-01-02T13:03:33","slug":"libexif%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f","status":"publish","type":"post","link":"https:\/\/mattyan.net\/blog\/?p=1684","title":{"rendered":"libexif\u4f7f\u3063\u3066\u307f\u305f"},"content":{"rendered":"<p>\u30ab\u30e1\u30e9\u3092\u7e26\u306b\u3057\u3066\u64ae\u308b\u3068\u3001PC\u3067\u307f\u305f\u6642\u5927\u62b5\u306e\u30d3\u30e5\u30ef\u30fc\u3060\u3068\u5199\u771f\u304c\u6a2a\u306b\u306a\u308b\u306e\u3067\u3001\u30d5\u30a9\u30eb\u30c0\u3054\u3068\u30c9\u30e9\u30c3\u30b0\u30a2\u30f3\u30c9\u30c9\u30ed\u30c3\u30d7\u3057\u305f\u3089\u4e2d\u306b\u3042\u308bjpg\u30d5\u30a1\u30a4\u30eb\u624b\u5f53\u305f\u308a\u6b21\u7b2c\u306b\u8abf\u3079\u3066\u56de\u8ee2\u3057\u3066\u308b\u5199\u771f\u306f\u6b63\u3057\u3044\u5411\u304d\u306b\u306a\u308b\u3088\u3046\u306b\u4fee\u6b63\u3059\u308b\u30c4\u30fc\u30eb\u304c\u3042\u308b\u3068\u4fbf\u5229\u3060\u306a\u3068\u601d\u3063\u3066\u3061\u3087\u3063\u3068\u8abf\u3079\u3066\u307f\u305f\u3002<br \/>\n\u56de\u8ee2\u60c5\u5831\u306fExif\u306b\u8a18\u9332\u3055\u308c\u3066\u308b\u3088\u3046\u306a\u306e\u3067\u3001Exif\u3067\u56de\u8ee2\u60c5\u5831\u3092\u8abf\u3079\u3066\u5fc5\u8981\u306a\u3089ImageMagick\u3067\u56de\u305b\u3070\u3044\u3044\u3084\u3068\u306a\u308a\u3001Exif\u64cd\u4f5c\u30e9\u30a4\u30d6\u30e9\u30ea\u306e<a href=\"http:\/\/libexif.sourceforge.net\/\">libexif<\/a>\u3092\u5c0e\u5165\u3002<br \/>\n[cpp]<br \/>\n\/**<br \/>\n * main.cpp<br \/>\n * exif\u306eorientation\u60c5\u5831\u53d6\u5f97<br \/>\n * @date 2014\/01\/02<br \/>\n * @author \u307e\u3063\u3061\u3083\u3093<br \/>\n *\/<br \/>\n#include &lt;libexif\/exif-data.h&gt;<br \/>\n#include &lt;iostream&gt;<br \/>\nint main(int argc, char *argv[]){<br \/>\n\tif(argc &lt; 2){<br \/>\n\t\treturn 0;<br \/>\n\t}<br \/>\n\t\/\/Exif\u8aad\u307f\u8fbc\u307f<br \/>\n\tExifData *exifData = exif_data_new_from_file(argv[1]);<br \/>\n\tif(exifData == nullptr){<br \/>\n\t\treturn 0;<br \/>\n\t}<br \/>\n\t\/\/\u30aa\u30ea\u30a8\u30f3\u30c6\u30fc\u30b7\u30e7\u30f3\u60c5\u5831\u53d6\u5f97<br \/>\n\tExifEntry *entry = exif_content_get_entry(exifData-&gt;ifd[EXIF_IFD_0], EXIF_TAG_ORIENTATION);<br \/>\n\tint orientation = 0;<br \/>\n\tif(entry != nullptr){<br \/>\n\t\tstd::cout &lt;&lt; exif_get_short(entry-&gt;data, exif_data_get_byte_order (entry-&gt;parent-&gt;parent)) &lt;&lt; std::endl;<br \/>\n\t}<br \/>\n\texif_data_unref(exifData);<br \/>\n\treturn 0;<br \/>\n}<br \/>\n[\/cpp]<br \/>\nexif_data_new_from_file\u306b\u8aad\u307f\u8fbc\u3080jpeg\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u3092\u6e21\u3057\u3066ExifData\u69cb\u9020\u4f53\u306e\u30dd\u30a4\u30f3\u30bf\u3092\u53d6\u5f97\u3002<br \/>\nexif_content_get_entry\u3067IFD0\u306b\u5165\u3063\u3066\u308bORIENTATION\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3002\u3053\u308c\u304c\u56de\u8ee2\u60c5\u5831\u3002<br \/>\n\u30b5\u30f3\u30d7\u30eb\u3092\u898b\u308b\u3068exif_entry_get_value\u3067\u53d6\u5f97\u3059\u308b\u3088\u3046\u306b\u898b\u3048\u308b\u3051\u3069\u3001\u3053\u308c\u3067\u53d6\u3063\u3066\u304f\u308b\u3068\u300c\u5de6\u4e0a\u300d\u3068\u304b\u6271\u3044\u306b\u56f0\u308b\u3082\u306e\u304c\u5e30\u3063\u3066\u304f\u308b\u306e\u3067\u3001exif_get_short(entry->data, exif_data_get_byte_order (entry->parent->parent))\u3067\u56de\u8ee2\u60c5\u5831\u3092\u53d6\u5f97\u3002<br \/>\n\u6700\u5f8c\u306bexif_data_unref\u3067exif\u30c7\u30fc\u30bf\u3092\u89e3\u653e\u3057\u3066\u7d42\u4e86\u3002<br \/>\n\u3067\u3001\u3053\u3053\u307e\u3067\u8abf\u3079\u3066\u66f8\u3044\u305f\u3068\u3053\u308d\u3067\u3001ImageMagick\u3067\u305d\u306e\u8fba\u51e6\u7406\u3067\u304d\u308b\u3053\u3068\u304c\u5224\u660e\u3057\u3066\u3061\u3087\u3063\u3068\u51f9\u3080\u3002<br \/>\nlibexif\u306f\u306a\u3093\u304b\u9055\u3046\u3068\u304d\u306b\u4f7f\u304a\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30ab\u30e1\u30e9\u3092\u7e26\u306b\u3057\u3066\u64ae\u308b\u3068\u3001PC\u3067\u307f\u305f\u6642\u5927\u62b5\u306e\u30d3\u30e5\u30ef\u30fc\u3060\u3068\u5199\u771f\u304c\u6a2a\u306b\u306a\u308b\u306e\u3067\u3001\u30d5\u30a9\u30eb\u30c0\u3054\u3068\u30c9\u30e9\u30c3\u30b0\u30a2\u30f3\u30c9\u30c9\u30ed\u30c3\u30d7\u3057\u305f\u3089\u4e2d\u306b\u3042\u308bjpg\u30d5\u30a1\u30a4\u30eb\u624b\u5f53\u305f\u308a\u6b21\u7b2c\u306b\u8abf\u3079\u3066\u56de\u8ee2\u3057\u3066\u308b\u5199\u771f\u306f\u6b63\u3057\u3044\u5411\u304d\u306b\u306a\u308b\u3088\u3046\u306b\u4fee\u6b63\u3059\u308b\u30c4\u30fc\u30eb\u304c\u3042\u308b\u3068\u4fbf\u5229 &hellip; <a href=\"https:\/\/mattyan.net\/blog\/?p=1684\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">libexif\u4f7f\u3063\u3066\u307f\u305f<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,1],"tags":[],"class_list":["post-1684","post","type-post","status-publish","format-standard","hentry","category-3","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1684","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1684"}],"version-history":[{"count":0,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1684\/revisions"}],"wp:attachment":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}