FileConvert[source"dest.ext"]
source コンテンツを拡張子 ext で定義された形式に変換し,結果をファイル dest.ext に書き出す.
FileConvert[source,"format"]
結果を sourceで定義されたファイル名で,指定された形式で定義された拡張子を持つファイルに書き出す.
FileConvert[source"dest.ext","format1""format2"]
source のコンテンツが形式"format1"で指定された形式であると解釈する.
FileConvert
形式のリスト »FileConvert[source"dest.ext"]
source コンテンツを拡張子 ext で定義された形式に変換し,結果をファイル dest.ext に書き出す.
FileConvert[source,"format"]
結果を sourceで定義されたファイル名で,指定された形式で定義された拡張子を持つファイルに書き出す.
FileConvert[source"dest.ext","format1""format2"]
source のコンテンツが形式"format1"で指定された形式であると解釈する.
詳細とオプション
- FileConvertは,画像ファイル形式や音声ファイル形式のような互換形式間でのみ変換できる.
- ファイルは,Importでサポートされる形式からExportでサポートされる形式に変換できる.
- サポートされる形式は,$ImportFormatsおよび$ExportFormatsにリストされる.
- ファイル形式は,デフォルトで,FileFormatから推測される.
- FileConvert[source,…]の source は以下のいずれでもよい.
-
"file" または File["file"] $Pathで検索されたファイル名 "url" または URL["url"] HTTP,HTTPSまたはFTP URL - FileConvertからの出力はDirectory[]で指定される現行の作業ディレクトリに書き込まれる.
- 次は,使用可能なオプションである.
-
CreateIntermediateDirectories True 中間ディレクトリを作るかどうか OverwriteTarget True 既存のファイルを上書きするかどうか - FileConvert[url,…]は次のURLDownloadオプションを取る.
-
Authentication None 送信する認証情報 CookieFunction Automatic 受け取った各クッキーに適用する関数 ConnectionSettings Automatic 接続の速度およびその他の設定 FollowRedirects True HTTPリダイレクトに従うかどうか Interactive True インタラクティブな認証ダイアログを許可するかどうか TimeConstraint Infinity 応答を待つ時間 VerifySecurityCertificates True SSLセキュリティ証明書を検証するかどうか - ほとんどの場合,FileConvertは,事実上,Export["file.ext",Import[source]]に等しい.
例題
すべて開く すべて閉じる例 (2)
スコープ (14)
基本的な用法 (6)
FileConvertは,形式が指定されていない場合は,出力ファイルの拡張子から形式を推測しようとする:
FileConvert["ExampleData/rose.gif" -> "flower.jpg"]FileFormat[%]FileConvert["ExampleData/rose.gif" -> "flower", "PNG"]FileFormat[%]出力ファイルの名前が指定されていない場合は,同じファイル名が新たな拡張子とともに使われる:
FileConvert["ExampleData/rose.gif", "PNG"]Export["hundred", Partition[Range[100], 10], "CSV"]FileConvert["hundred", "CSV" -> "TSV"]FileFormat[%]Export["hundred.txt", Partition[Range[100], 10], "CSV"]FileConvert["hundred.txt" -> "hundred", "CSV" -> "TSV"]FileFormat[%]FileConvert[URL["http://exampledata.wolfram.com/article.pdf"] -> "test.png"]形式タイプ (8)
Audio (1)
Image (2)
FileConvert["ExampleData/spikey.tiff", "JPEG"]FileByteCount /@ {FindFile@"ExampleData/spikey.tiff", %}FileConvert["ExampleData/wave.gif", "PNG"]Import[%, "Animation"]Tabular (2)
Import["ExampleData/financialtimeseries.csv", "CSV"] === Import[FileConvert["ExampleData/financialtimeseries.csv", "TSV"], "TSV"]Import["ExampleData/classification.tsv", "TSV"] === Import[FileConvert["ExampleData/classification.tsv", "TSV"], "TSV"]FileConvert["ExampleData/financialtimeseries.csv", "XLSX"]データがXLSXファイルの最初のシートに保存されたことに注意のこと:
Import[%, {"Data", 1}] === Import["ExampleData/financialtimeseries.csv"]Video (2)
FileConvert["ExampleData/bullfinch.mkv", "MP4"]FLVファイルを作成し,MP4に変換する.これには完全なFFmpegのインストールが必要である:
m = Manipulate[Plot3D[Sin[x y + a], {x, 0, 6}, {y, 0, 6}, ...], {a, 0, 4}];Export["manipulate.flv", m]"MP4"に変換する:
FileConvert["manipulate.flv", "VideoFormat" -> "MP4"]オプション (3)
CreateIntermediateDirectories (1)
FileConvert["ExampleData/rose.gif" -> "NewDirectory/image.png", CreateIntermediateDirectories -> True]FileFormat[%]CreateIntermediateDirectoriesFalseのときは,存在しないディレクトリは作られない:
FileConvert["ExampleData/rose.gif" -> "MissingDirectory/image.png", CreateIntermediateDirectories -> False]OverwriteTarget (2)
デフォルトで,FileConvertは既存の出力ファイルを上書きする:
Export["hello.txt", "Hello, world!"];FileConvert["ExampleData/financialtimeseries.csv" -> "hello.txt"]Import["hello.txt"]//ShortOverwriteTargetFalseを使って現行ファイルの上書きを防ぐ:
Export["hello.txt", "Hello, world!"];FileConvert["ExampleData/financialtimeseries.csv" -> "hello.txt", OverwriteTarget -> False]Import["hello.txt"]アプリケーション (1)
FileSystemMapを使って,あるファイルタイプのディレクトリ全体を新たな形式に変換する:
dir = CreateDirectory[];
Table[Export[FileNameJoin[{dir, "test " <> ToString[i] <> ".png"}], ConstantImage[RandomColor[]]], {i, 4}];
SetDirectory[dir];FileSystemMap[FileConvert[#, "JPEG"]&, dir, FileNameForms -> "*.png"]考えられる問題 (4)
FileConvert["ExampleData/rose.gif", "MP3"]FileConvertは圧縮したアーカイブを作ることができない:
FileConvert["ExampleData/rose.gif", "ZIP"]CreateArchiveを使って圧縮したアーカイブを作る:
CreateArchive[FindFile["ExampleData/rose.gif"]]XLSとXLSXのデータはシートにグループ化されるので,CSVまたはTSVに変換することはできない:
FileConvert["ExampleData/cities.xlsx", "CSV"]Import[%] === Import["ExampleData/cities.xlsx"]XLSXとXLSのデータは,ImportおよびExportを使ってシートごとに効率的に変換できる:
data = Import["ExampleData/cities.xlsx", {"Data", 1}];Export["cities.csv", data]Import["cities.csv", "CSV"] === data関連するガイド
テキスト
Wolfram Research (2019), FileConvert, Wolfram言語関数, https://reference.wolfram.com/language/ref/FileConvert.html (2020年に更新).
CMS
Wolfram Language. 2019. "FileConvert." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/FileConvert.html.
APA
Wolfram Language. (2019). FileConvert. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FileConvert.html
BibTeX
@misc{reference.wolfram_2026_fileconvert, author="Wolfram Research", title="{FileConvert}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/FileConvert.html}", note=[Accessed: 05-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_fileconvert, organization={Wolfram Research}, title={FileConvert}, year={2020}, url={https://reference.wolfram.com/language/ref/FileConvert.html}, note=[Accessed: 05-September-2026]}