{"id":2008,"date":"2017-11-03T16:43:13","date_gmt":"2017-11-03T07:43:13","guid":{"rendered":"http:\/\/okamurax.com\/?p=2008"},"modified":"2017-11-04T21:26:50","modified_gmt":"2017-11-04T12:26:50","slug":"c-%e7%94%bb%e5%83%8f%e3%82%b5%e3%83%a0%e3%83%8d%e3%82%a4%e3%83%ab%e3%82%92%e5%8f%96%e5%be%97","status":"publish","type":"post","link":"https:\/\/appbay.org\/?p=2008","title":{"rendered":"C# \u753b\u50cf\u30b5\u30e0\u30cd\u30a4\u30eb\u3092\u53d6\u5f97"},"content":{"rendered":"<p>\u6a19\u6e96\u30b5\u30e0\u30cd\u30a4\u30eb\u3092\u30b9\u30c8\u30ea\u30fc\u30e0\u7d4c\u7531\u3067\u53d6\u5f97\u3057\u3066ListView\u306b\u8868\u793a\u3002<\/p>\n<pre class=\"lang:c# decode:true \">imageList1.ImageSize = new Size(256, 256);\r\nimageList1.ColorDepth = ColorDepth.Depth24Bit;\r\nlistView1.LargeImageList = imageList1;\r\n\r\nstring path = textBox2.Text;\r\nstring[] files;\r\n            \r\nfiles = System.IO.Directory.GetFiles(path,\"*.jpg\");\r\nfor(int i = 0; i &lt; files.Length; i++)\r\n{\r\n    using (System.IO.FileStream fs = System.IO.File.OpenRead(files[i]))\r\n    {\r\n        Image img = Image.FromStream(fs,false,false);\r\n        Image theme = img.GetThumbnailImage(200, 200, delegate { return false; }, IntPtr.Zero);\r\n\r\n        imageList1.Images.Add(theme);\r\n        listView1.Items.Add(files[i],i);\r\n    }\r\n}\r\n<\/pre>\n<p>ffmpeg\u3067\u30b5\u30e0\u30cd\u30a4\u30eb\u3092\u53d6\u5f97\u3059\u308b\u30bf\u30a4\u30d7\u3002\u753b\u50cf\u306b\u305b\u305a\u6a19\u6e96\u51fa\u529b\u7d4c\u7531\u3002<\/p>\n<pre class=\"lang:c# decode:true \">\/\/ffmpeg\u304b\u3089\u76f4\u63a5\u753b\u50cf\u3068\u3057\u3066\u4fdd\u5b58\r\nstring path = \"\";\r\nstring[] files = System.IO.Directory.GetFiles(path, \"*.mp4\");\r\n\r\nSystem.Diagnostics.Process p = new System.Diagnostics.Process();\r\np.StartInfo.FileName = Application.StartupPath + @\"\\ffmpeg.exe\";\r\np.StartInfo.Arguments = \"-ss 50 -i \\\"\" + files[0] + \"\\\" -vframes 1 -f image2 tmp1.jpg\";\r\np.StartInfo.RedirectStandardOutput = true;\r\np.StartInfo.CreateNoWindow = true;\r\np.StartInfo.UseShellExecute = false;\r\np.Start();\r\n\r\n\/\/\u4e00\u65e6Image\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u3057\u3066\u304b\u3089\u753b\u50cf\u3068\u3057\u3066\u4fdd\u5b58\r\nstring path = \"\";\r\nstring[] files = System.IO.Directory.GetFiles(path, \"*.mp4\");\r\n\r\nSystem.Diagnostics.Process p = new System.Diagnostics.Process();\r\np.StartInfo.FileName = Application.StartupPath + @\"\\ffmpeg.exe\";\r\np.StartInfo.Arguments = \"-ss 50 -i \\\"\" + files[0] + \"\\\" -vframes 1 -f image2 pipe:1\";\r\np.StartInfo.RedirectStandardOutput = true;\r\np.StartInfo.CreateNoWindow = true;\r\np.StartInfo.UseShellExecute = false;\r\np.Start();\r\n\r\nImage img = Image.FromStream(p.StandardOutput.BaseStream);\r\nimg.Save(Application.StartupPath + @\"\\tmp2.jpg\");\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6a19\u6e96\u30b5\u30e0\u30cd\u30a4\u30eb\u3092\u30b9\u30c8\u30ea\u30fc\u30e0\u7d4c\u7531\u3067\u53d6\u5f97\u3057\u3066ListView\u306b\u8868\u793a\u3002 imageList1.ImageSize = new Size(256, 256); imageList1.ColorDepth = ColorDepth &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/appbay.org\/?p=2008\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;C# \u753b\u50cf\u30b5\u30e0\u30cd\u30a4\u30eb\u3092\u53d6\u5f97&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9],"class_list":["post-2008","post","type-post","status-publish","format-standard","hentry","category-1","tag-c-net"],"_links":{"self":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/2008","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2008"}],"version-history":[{"count":5,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/2008\/revisions"}],"predecessor-version":[{"id":2017,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/2008\/revisions\/2017"}],"wp:attachment":[{"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2008"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}