{"id":10656,"date":"2020-11-24T12:32:17","date_gmt":"2020-11-24T03:32:17","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=10656"},"modified":"2020-12-05T15:48:35","modified_gmt":"2020-12-05T06:48:35","slug":"%ec%b9%b4%eb%a9%94%eb%9d%bc%eb%a1%9c-%ec%b0%8d%ec%9d%80-%ec%9d%b4%eb%af%b8%ec%a7%80-%ec%98%ac%eb%b0%94%eb%a5%b8-%eb%b0%a9%ed%96%a5%ec%9c%bc%eb%a1%9c-%ed%9a%8c%ec%a0%84%ec%8b%9c%ec%bc%9c-%eb%b3%b4","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=10656","title":{"rendered":"[Android] \uce74\uba54\ub77c\ub85c \ucc0d\uc740 \uc774\ubbf8\uc9c0 \uc62c\ubc14\ub978 \ubc29\ud5a5\uc73c\ub85c \ud68c\uc804\uc2dc\ucf1c \ubcf4\uc5ec\uc8fc\uae30"},"content":{"rendered":"<p>\uc548\ub4dc\ub85c\uc774\ub4dc\uc758 \ud3f0\uc5d0\uc11c \ucc0d\uc740 \uc0ac\uc9c4\uc740 \ub0b4\ubd80\uc801\uc73c\ub85c \uce74\uba54\ub77c\uc758 \ud68c\uc804 \uc815\ubcf4\uac00 \ub2f4\uaca8 \uc788\uc2b5\ub2c8\ub2e4. \ud3f0\uc73c\ub85c \ucc0d\uc740 \uc0ac\uc9c4\uc744 \ud654\uba74\uc5d0 \ud45c\uc2dc\ud560\ub54c \uc774 \ud654\uc804 \uc815\ubcf4\ub97c \ubc18\uc601\ud558\uc5ec \ucd2c\uc601\ub41c \uc774\ubbf8\uc9c0\ub97c \ud45c\uc2dc\ud574\uc57c \uc790\uc5f0\uc2a4\ub7fd\uc2b5\ub2c8\ub2e4. \uc544\ub798\uc758 \ucf54\ub4dc\ub294 \uc774\ubbf8\uc9c0 \ud30c\uc77c\uc5d0 \ub300\ud55c \ud68c\uc804 \uc815\ubcf4\ub97c \uc5bb\ub294 \ucf54\ub4dc\uc785\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"kotlin\">\r\nval imageFilePath = \"...... . jpg\"\r\nval ei = ExifInterface(imageFilePath)\r\nval orientation: Int = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED)\r\nval angle = when(orientation) {\r\n    ExifInterface.ORIENTATION_ROTATE_90 -> 90f\r\n    ExifInterface.ORIENTATION_ROTATE_180 -> 180f\r\n    ExifInterface.ORIENTATION_ROTATE_270 -> 270f\r\n    else -> 0f\r\n}\r\n<\/pre>\n<p>\uc704\uc758 \ucf54\ub4dc\ub97c \ud1b5\ud574 \uc774\ubbf8\uc9c0\uc758 \ud68c\uc804 \uac01\ub3c4\ub974 \uc5bb\uc5b4\uc62c \uc218 \uc788\uace0, \uc774\ub97c \ud1a0\ub300\ub85c \uc774\ubbf8\uc9c0\ub97c \uc2e4\uc81c\ub85c \ud68c\uc804\uc2dc\ud0a4\ub294 \ucf54\ub4dc\ub294 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"kotlin\">\r\nprivate fun resizeBitmap(src: Bitmap, size: Float, angle: Float): Bitmap {\r\n    val width = src.width\r\n    val height = src.height\r\n\r\n    var newWidth = 0f\r\n    var newHeight = 0f\r\n\r\n    if(width > height) {\r\n        newWidth = size\r\n        newHeight = height.toFloat() * (newWidth \/ width.toFloat())\r\n    } else {\r\n        newHeight = size\r\n        newWidth = width.toFloat() * (newHeight \/ height.toFloat())\r\n    }\r\n\r\n    val scaleWidth = newWidth.toFloat() \/ width\r\n    val scaleHeight = newHeight.toFloat() \/ height\r\n\r\n    val matrix = Matrix()\r\n\r\n    matrix.postRotate(angle);\r\n    matrix.postScale(scaleWidth, scaleHeight)\r\n\r\n    val resizedBitmap = Bitmap.createBitmap(src, 0, 0, width, height, matrix, true)\r\n    return resizedBitmap\r\n}\r\n<\/pre>\n<p>\uc704\uc758 \ud568\uc218\ub294 \uce74\uba54\ub77c\ub85c \ucc0d\uc740 \uc774\ubbf8\uc9c0\ub97c \ud68c\uc804\uc2dc\ucf1c \uc8fc\ub294 \uac83\ubfd0\ub9cc \uc544\ub2c8\ub77c \uc774\ubbf8\uc9c0\uc758 \ud06c\uae30\ub97c \ud654\uba74\uc5d0 \ud45c\uc2dc\ud558\uae30\uc5d0 \uc801\ub2f9\ud55c \ud06c\uae30\ub97c \uc778\uc790\ub85c \ubc1b\uc544 \uc904\uc5ec\uc90d\ub2c8\ub2e4. \uc2e4\uc81c \uc0ac\uc6a9\ud558\ub294 \ucf54\ub4dc\ub294 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"kotlin\">\r\nval imageFilePath = \"...... . jpg\"\r\nval file = File(imageFilePath)\r\n\r\nval angle = ...\r\n\r\nif(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {\r\n    val source = ImageDecoder.createSource(contentResolver, Uri.fromFile(file))\r\n    ImageDecoder.decodeBitmap(source)?.let {\r\n        imageView.setImageBitmap(resizeBitmap(it, 900f, 0f))\r\n    }\r\n} else {\r\n    MediaStore.Images.Media.getBitmap(contentResolver, Uri.fromFile(file))?.let {\r\n        imageView.setImageBitmap(resizeBitmap(it, 900f, 0f))\r\n    }\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\uc548\ub4dc\ub85c\uc774\ub4dc\uc758 \ud3f0\uc5d0\uc11c \ucc0d\uc740 \uc0ac\uc9c4\uc740 \ub0b4\ubd80\uc801\uc73c\ub85c \uce74\uba54\ub77c\uc758 \ud68c\uc804 \uc815\ubcf4\uac00 \ub2f4\uaca8 \uc788\uc2b5\ub2c8\ub2e4. \ud3f0\uc73c\ub85c \ucc0d\uc740 \uc0ac\uc9c4\uc744 \ud654\uba74\uc5d0 \ud45c\uc2dc\ud560\ub54c \uc774 \ud654\uc804 \uc815\ubcf4\ub97c \ubc18\uc601\ud558\uc5ec \ucd2c\uc601\ub41c \uc774\ubbf8\uc9c0\ub97c \ud45c\uc2dc\ud574\uc57c \uc790\uc5f0\uc2a4\ub7fd\uc2b5\ub2c8\ub2e4. \uc544\ub798\uc758 \ucf54\ub4dc\ub294 \uc774\ubbf8\uc9c0 \ud30c\uc77c\uc5d0 \ub300\ud55c \ud68c\uc804 \uc815\ubcf4\ub97c \uc5bb\ub294 \ucf54\ub4dc\uc785\ub2c8\ub2e4. val imageFilePath = &#8220;&#8230;&#8230; . jpg&#8221; val ei = ExifInterface(imageFilePath) val orientation: Int = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED) val angle = when(orientation) { ExifInterface.ORIENTATION_ROTATE_90 -> &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=10656\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;[Android] \uce74\uba54\ub77c\ub85c \ucc0d\uc740 \uc774\ubbf8\uc9c0 \uc62c\ubc14\ub978 \ubc29\ud5a5\uc73c\ub85c \ud68c\uc804\uc2dc\ucf1c \ubcf4\uc5ec\uc8fc\uae30&#8221;<\/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":[61],"tags":[],"class_list":["post-10656","post","type-post","status-publish","format-standard","hentry","category-android"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10656","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10656"}],"version-history":[{"count":3,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10656\/revisions"}],"predecessor-version":[{"id":10686,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10656\/revisions\/10686"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10656"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}