teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

6

コードの挿入

2020/06/30 03:14

投稿

katsumasa35
katsumasa35

スコア4

title CHANGED
File without changes
body CHANGED
@@ -8,12 +8,13 @@
8
8
 
9
9
  ```
10
10
  エラーメッセージ
11
- ```Traceback (most recent call last):
11
+ `Traceback (most recent call last):
12
12
  File "ark.py", line 24, in <module>
13
13
  page.save(str(image_path), "JPEG")
14
14
  File "C:\Users\jimuark2020-3\AppData\Local\Programs\Python\Python38-32\lib\site-packages\PIL\Image.py", line 2131, in save
15
15
  fp = builtins.open(filename, "w+b")
16
- FileNotFoundError: [Errno 2] No such file or directory: 'Desktop\PdfToImage\image_file\wanz_01.jpeg'
16
+ FileNotFoundError: [Errno 2] No such file or directory: 'Desktop\PdfToImage\image_file\wanz_01.jpeg'`
17
+
17
18
 
18
19
  ### 該当のソースコード
19
20
 

5

コードの挿入

2020/06/30 03:14

投稿

katsumasa35
katsumasa35

スコア4

title CHANGED
File without changes
body CHANGED
@@ -18,7 +18,7 @@
18
18
  ### 該当のソースコード
19
19
 
20
20
 
21
- ```Python
21
+ `Python`
22
22
  コード
23
23
  `import pdf2image
24
24
  import os

4

コードの挿入

2020/06/30 03:13

投稿

katsumasa35
katsumasa35

スコア4

title CHANGED
File without changes
body CHANGED
@@ -20,7 +20,22 @@
20
20
 
21
21
  ```Python
22
22
  コード
23
+ `import pdf2image
24
+ import os
25
+ from pathlib import Path
26
+ from pdf2image import convert_from_path
27
+ import tkinter, tkinter.filedialog, tkinter.messagebox
28
+ from PIL import Image
29
+
30
+ root = tkinter.Tk()
31
+ root.withdraw()
32
+ fTyp = [("","*")]
33
+ iDir = os.path.abspath(os.path.dirname("__file__"))
34
+ tkinter.messagebox.showinfo('正誤判定','処理ファイルを選択してください')
35
+ file = tkinter.filedialog.askopenfilename(filetypes = fTyp,initialdir = iDir)
36
+
37
+ tkinter.messagebox.showinfo('○×プログラム',file)
23
- `poppler_dir = Path("__file__").parent.absolute() / "poppler/bin"
38
+ poppler_dir = Path("__file__").parent.absolute() / "poppler/bin"
24
39
  os.environ["PATH"] += os.pathsep + str(poppler_dir)
25
40
  pdf_path = Path(file)
26
41
  pages = convert_from_path(str(pdf_path),150)

3

書式の改善

2020/06/30 03:06

投稿

katsumasa35
katsumasa35

スコア4

title CHANGED
File without changes
body CHANGED
@@ -20,8 +20,7 @@
20
20
 
21
21
  ```Python
22
22
  コード
23
- ```
24
- poppler_dir = Path("__file__").parent.absolute() / "poppler/bin"
23
+ `poppler_dir = Path("__file__").parent.absolute() / "poppler/bin"
25
24
  os.environ["PATH"] += os.pathsep + str(poppler_dir)
26
25
  pdf_path = Path(file)
27
26
  pages = convert_from_path(str(pdf_path),150)
@@ -47,7 +46,7 @@
47
46
  builder = pyocr.builders.TextBuilder()
48
47
  result1 = tool.image_to_string(img_box, lang="jpn", builder=builder)
49
48
 
50
- print(result1)
49
+ print(result1)`
51
50
 
52
51
  ### 試したこと
53
52
 

2

コードの挿入

2020/06/30 02:59

投稿

katsumasa35
katsumasa35

スコア4

title CHANGED
File without changes
body CHANGED
@@ -18,7 +18,7 @@
18
18
  ### 該当のソースコード
19
19
 
20
20
 
21
- ```python
21
+ ```Python
22
22
  コード
23
23
  ```
24
24
  poppler_dir = Path("__file__").parent.absolute() / "poppler/bin"

1

コードの挿入

2020/06/30 02:00

投稿

katsumasa35
katsumasa35

スコア4

title CHANGED
File without changes
body CHANGED
@@ -17,24 +17,10 @@
17
17
 
18
18
  ### 該当のソースコード
19
19
 
20
+
20
21
  ```python
21
- ソースコード
22
+ コード
22
- ```import pdf2image
23
+ ```
23
- import os
24
- from pathlib import Path
25
- from pdf2image import convert_from_path
26
- import tkinter, tkinter.filedialog, tkinter.messagebox
27
- from PIL import Image
28
-
29
- root = tkinter.Tk()
30
- root.withdraw()
31
- fTyp = [("","*")]
32
- iDir = os.path.abspath(os.path.dirname("__file__"))
33
- tkinter.messagebox.showinfo('正誤判定','処理ファイルを選択してください')
34
- file = tkinter.filedialog.askopenfilename(filetypes = fTyp,initialdir = iDir)
35
-
36
- tkinter.messagebox.showinfo('○×プログラム',file)
37
-
38
24
  poppler_dir = Path("__file__").parent.absolute() / "poppler/bin"
39
25
  os.environ["PATH"] += os.pathsep + str(poppler_dir)
40
26
  pdf_path = Path(file)