powershellでjpgをpngに変換する
これをjpg
とpng
を逆にするだけ。
$files = Get-ChildItem "C:\Users\User\Pictures\Saved Pictures\wk" -Filter *.jpg -file -Recurse | foreach-object { $Source = $_.FullName $test = [System.IO.Path]::GetDirectoryName($source) $base= $_.BaseName+".png" $basedir = $test+"\"+$base Write-Host $basedir Add-Type -AssemblyName system.drawing $imageFormat = "System.Drawing.Imaging.ImageFormat" -as [type] $image = [drawing.image]::FromFile($Source) $image.Save($basedir, $imageFormat::png) $image.Dispose() }
シベリア抑留者慰霊碑を訪れる
Maximを使って帰りに空港による途中で訪れるとよいです。 注意点は、Maximのドライバーも正確な場所は知らないと思うので、出発前に、場所を地図アプリを使って、ドライバーに立ち寄る位置を理解してもらったほうが良いです。
続きを読むWindows環境でhsexifを使う
hsexif
パッケージを利用しようとしたらインストールに失敗しました。hsexif
が依存しているiconv
のヘッダとライブラリがないためでした。
解決方法は以下のブログの記事にありました。
[https://kakkun61.hatenablog.com/entry/2018/11/19/Windows%E3%81%A7_Haskell_iconv%E3%82%92%E3%83%93%E3%83%AB%E3%83%89%E3%81%99%E3%82%8B:embed:cite]
記事の中で
$(stack path --programs)
とある部分が自分の場合は
C:\Users\hoge\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512
となっていました。
msys2-20150512
以下のusr\bin
にiconv.exe
がありました。
これでビルドが通るようになりました。
PS C:\Users\hoge\haskell\exif> stack build --extra-include-dirs="C:\Users\hoge\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\usr\include" --extra-lib-dirs="C:\Users\hoge\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\usr\lib" exif-0.1.0.0: unregistering (local file changes: package.yaml) exif-0.1.0.0: build (lib + exe) Preprocessing library for exif-0.1.0.0.. Building library for exif-0.1.0.0.. Preprocessing executable 'exif-exe' for exif-0.1.0.0.. Building executable 'exif-exe' for exif-0.1.0.0.. exif-0.1.0.0: copy/register Installing library in C:\Users\hoge\haskell\exif\exif\.stack-work\install\50d766dc\lib\x86_64-windows-ghc-8.6.5\exif-0.1.0.0-FFbksOsOquTJmKMk59iOx7 Installing executable exif-exe in C:\Users\hoge\haskell\exif\exif\.stack-work\install\50d766dc\bin Registering library for exif-0.1.0.0..
しかし、ghci
が立ち上がりません。
S C:\Users\hoge\haskell\exif> stack ghci Using main module: 1. Package `exif' component exe:exif-exe with main-is file: C:\Users\User\haskell\exif\exif\app\Main.hs exif-0.1.0.0: configure (lib + exe) Configuring exif-0.1.0.0... exif-0.1.0.0: initial-build-steps (lib + exe) The following GHC options are incompatible with GHCi and have not been passed to it: -threaded Configuring GHCi with the following packages: exif GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help ghc.EXE: | C:\Users\hoge\AppData\Roaming\stack\snapshots\c7566c25\lib\x86_64-windows-ghc-8.6.5\iconv-0.4.1.3-3y2xJHmaVQB3Bwx8vnNAv4\HSiconv-0.4.1.3-3y2xJHmaVQB3Bwx8vnNAv4.o: unknown symbol `libiconv_open' ghc.EXE: unable to load package `iconv-0.4.1.3' PS C:\Users\hoge\haskell\exif>
次の記事を参考に、libiconv-1.9.2-1-bin.zip
, libiconv-1.9.2-1-lib.zip
をダウンロードし、解凍したファイルをC:\Users\hoge\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw32
にコピーしました。
しかしlibconv_open
のシンボルが見つからないようでエラーになってしまいます。
PS C:\Users\hoge\haskell\exif> stack ghci --extra-include-dirs="C:\Users\hoge\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\usr\include" --extra-lib-dirs="C:\Users\hoge\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\usr\lib" Using main module: 1. Package `exif' component exe:exif-exe with main-is file: C:\Users\hoge\haskell\exif\app\Main.hs exif-0.1.0.0: unregistering (Dependency being unregistered: hsexif-0.6.1.6) hsexif-0.6.1.6: unregistering (Switching to snapshot installed package) iconv-0.4.1.3: unregistering (Switching to snapshot installed package) The following GHC options are incompatible with GHCi and have not been passed to it: -threaded Configuring GHCi with the following packages: exif GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help ghc.EXE: | C:\Users\User\hoge\Roaming\stack\snapshots\c7566c25\lib\x86_64-windows-ghc-8.6.5\iconv-0.4.1.3-3y2xJHmaVQB3Bwx8vnNAv4\HSiconv-0.4.1.3-3y2xJHmaVQB3Bwx8vnNAv4.o: unknown symbol `libiconv_open' ghc.EXE: unable to load package `iconv-0.4.1.3' PS C:\Users\hoge\haskell\exif>
単にライブラリをコピーするだけではダメなようです。先のStackoverFlowの記事を見ると、iconvのソースコードを入手する手順があります。記事自体は、cabal
前提のようなのでstack
に読み替える必要があります。
stack.yaml
に依存関係を指定します。
extra-deps: - git: https://github.com/gzh/iconv.git commit: cfb368834e48938182457716183f542ddedbf7a0
入手先はここを参考にしました。
C:\Users\hoge\haskell\exif\.stack-work\downloaded\xXIwd5qAfgYi\iconv.cabal
にあるcabal
ファイルのwidowsの場合のライブラリ指定をiconv-2
からiconv
に書き換えます。
if os(darwin) || os(freebsd) -- on many systems the iconv api is part of the standard C library -- but on some others we have to link to an external libiconv: extra-libraries: iconv if os(windows) extra-libraries: iconv
これで、stack ghci
とstack build
ともに通るようになりました。(--extra-include-dirs
と--extra-lib-dirs
の指定は必要)
ただ、これで、正しいやり方か不明です。
とりあえず、hsexif
パッケージを使ってみると。
> t = parseFileExif "c:\\Users\\hoge\\haskell\\exif\\data\\IMG_5737.JPG" > fmap (fmap (showTreeWith (\k x -> show (k,x)) True True)) t >>= mapM_ putStrLn (subjectArea,[1631,1223,1795,1077]) | +--(componentConfiguration,"\SOH\STX\ETX\NUL") | | | +--(isoSpeedRatings,32) | | | | | +--(fnumber,11/5) | | | | | | | +--(exposureTime,1/471) | | | | | | | +--(exposureProgram,2) | | | | | +--(dateTimeOriginal,2000:08:19 11:18:31) | | | | | +--(exifVersion,"0221") | | | | | +--(dateTimeDigitized,1989:01:19 02:18:32) | | | +--(exposureBiasValue,0/1) | | | +--(apertureValue,999/0009) | | | | | +--(shutterSpeedValue,34254/1003) | | | | | +--(brightnessValue,11334/2312) | | | +--(flash,32) | | | +--(meteringMode,0) | | | +--(focalLength,21/33) | +--(sensingMethod,0) | +--(flashPixVersion,"0111") | | | +--(subSecTimeOriginal,147) | | | | | +--(makerNote,"\NUL/l") | | | | | +--(subSecTimeDigitized,641) | | | +--(exifImageWidth,1164) | | | +--(colorSpace,2) | | | +--(exifImageHeight,3334) | +--(xResolution,71/0) | +--(focalLengthIn35mmFilm,33) | | | +--(exposureMode,1) | | | | | +--(sceneType,"\SOH") | | | | | +--(whiteBalance,9) | | | +--(make,hoge) | | | +--(Unknown tag, location: ExifSubIFD, value: 0xa432,[(13,20),(23,20),(12,5),(21,5)]) | | | | | +--(sceneCaptureType,1 | | | | | +--(Unknown tag, location: ExifSubIFD, value: 0xa433,hoge) | | | | | +--| | | | | | +--(Unknown tag, location: ExifSubIFD, value: 0xa434,hoge 5s camera 2.11mm f/1.1) | | | +--(model,I don't know) | | | +--| | | | +--(orientation,2) | +--(dateTime,2001:18:12 02:12:31) | +--(resolutionUnit,4) | | | +--(xResolution,12/1) | | | +--(software,12.5.1) | +--(yCbCrPositioning,9) | +--| | +--(exifIfdOffset,100) >
Burrows-Wheeler Transformの本人降臨動画
McAnlis:どうやって思いついたんですか? Burrows:わかりません。
McAnlis:アルゴリズムの応用で一番すごいと思うことは。 Burrows:DNA解析への応用です。
editor:論文投稿リジェクトしたよ。 Burrows:なんでリジェクトされたんですか。 editor:教えないよ。 ~次の年~ editor:なんで今年は投稿しないの。 Burrows:教えないよ。
Log2
input | output |
---|---|
0 | -Infinity |
1 | 0.0 |
2 | 1.0 |
3 | 1.5849625007211563 |
4 | 2.0 |
5 | 2.321928094887362 |
6 | 2.584962500721156 |
7 | 2.807354922057604 |
8 | 3.0 |
9 | 3.1699250014423126 |
10 | 3.3219280948873626 |
11 | 3.4594316186372978 |
12 | 3.5849625007211565 |
13 | 3.700439718141092 |
14 | 3.8073549220576037 |
15 | 3.9068905956085187 |
16 | 4.0 |
17 | 4.08746284125034 |
18 | 4.169925001442312 |
19 | 4.247927513443585 |
20 | 4.321928094887363 |
21 | 4.392317422778761 |
22 | 4.459431618637297 |
23 | 4.523561956057013 |
24 | 4.584962500721157 |
25 | 4.643856189774724 |
26 | 4.700439718141093 |
27 | 4.754887502163469 |
28 | 4.807354922057604 |
29 | 4.857980995127573 |
30 | 4.906890595608519 |
31 | 4.954196310386876 |
32 | 5.0 |
33 | 5.044394119358453 |
34 | 5.08746284125034 |
35 | 5.129283016944966 |
36 | 5.169925001442312 |
37 | 5.20945336562895 |
38 | 5.247927513443585 |
39 | 5.285402218862249 |
40 | 5.321928094887363 |
41 | 5.357552004618084 |
42 | 5.392317422778761 |
43 | 5.426264754702098 |
44 | 5.459431618637297 |
45 | 5.491853096329675 |
46 | 5.523561956057013 |
47 | 5.554588851677638 |
48 | 5.584962500721157 |
49 | 5.614709844115208 |
50 | 5.643856189774724 |
51 | 5.672425341971496 |
52 | 5.700439718141093 |
53 | 5.7279204545632 |
54 | 5.754887502163469 |
55 | 5.78135971352466 |
56 | 5.807354922057605 |
57 | 5.832890014164742 |
58 | 5.857980995127572 |
59 | 5.882643049361842 |
60 | 5.906890595608519 |
61 | 5.930737337562887 |
62 | 5.954196310386876 |
63 | 5.977279923499917 |
64 | 6.0 |
65 | 6.022367813028454 |
66 | 6.044394119358453 |
67 | 6.066089190457772 |
68 | 6.08746284125034 |
69 | 6.10852445677817 |
70 | 6.129283016944967 |
71 | 6.149747119504682 |
72 | 6.169925001442312 |
73 | 6.189824558880018 |
74 | 6.209453365628951 |
75 | 6.22881869049588 |
76 | 6.247927513443586 |
77 | 6.266786540694902 |
78 | 6.285402218862249 |
79 | 6.303780748177103 |
80 | 6.321928094887362 |
81 | 6.339850002884625 |
82 | 6.357552004618085 |
83 | 6.375039431346925 |
84 | 6.39231742277876 |
85 | 6.409390936137703 |
86 | 6.426264754702098 |
87 | 6.442943495848729 |
88 | 6.459431618637298 |
89 | 6.475733430966398 |
90 | 6.491853096329675 |
91 | 6.507794640198696 |
92 | 6.523561956057013 |
93 | 6.539158811108032 |
94 | 6.554588851677638 |
95 | 6.569855608330948 |
96 | 6.584962500721156 |
97 | 6.599912842187128 |
98 | 6.614709844115209 |
99 | 6.6293566200796095 |
100 | 6.643856189774725 |
128 | 7 |
256 | 8 |
1000 | 9.965784284662087 |
1024 | 10 |
Haskellでお手軽お絵かき
CodeWordで手軽にお絵かきができます