Python Forum
Converted EXE file size is too large
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Converted EXE file size is too large
#1
I have converted the python script to exe format using the below command, but the exe file size is too large. So when executing the exe file, it is taking a long time to start the execution. Could you please help us to solve this issue. Thanks in Advance.

pyinstaller.exe --onefile tiff-2-txt.py

Script File Size: 1.90 KB
Converted EXE file size: 153 MB

Python = 3.8
Pyinstaller Version = 5.8.0

import os.path import cv2 import pytesseract ''' - language will be defined in "lang.ini" file in the same path of input files. - language code should be three digit iso code, multiple language should be add by separation of "+" symbol. e.g.: eng+hin - Tesseract version 5 should be installed in "C:\Program Files\Tesseract-OCR" ''' print("\n *********************************\n") print("\n OCR Tool - Output: Text format\n") print("\n Language code: Three letter iso code\n") print("\n Multiple language: add by separation of ""+"" symbol. e.g.: eng+hin \n") print("\n *********************************\n\n") filepath1 = input(" Enter the File path: ") filepath = filepath1 + "\\" filelist = os.path.isdir(filepath) for fname in os.listdir(filepath): if not fname.endswith(".tif"): continue path = os.path.join(filepath, fname) print(path) pytesseract.pytesseract.tesseract_cmd=r'C:\Program Files\Tesseract-OCR\tesseract.exe' img = cv2.imread(path) # load the image from the path using OpenCV library langu = filepath + "lang.ini" with open(langu) as f: # open the ini file ini = f.read() # read the ini file text = pytesseract.image_to_string(img, ini) test = os.path.splitext(fname)[0] txtname = filepath + test + ".txt" f = open(txtname,"w+", encoding="utf-8") f.write(text) cv2.waitKey(0) cv2.destroyAllWindows() print("OCR Completed")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I write formatted (i.e. bold, italic, change font size, etc.) text to a file? JohnJSal 13 35,394 May-20-2025, 12:26 PM
Last Post: hanmen9527
  Problems writing a large text file in python Vilius 4 1,968 Dec-21-2024, 09:20 AM
Last Post: Pedroski55
  validate large json file with millions of records in batches herobpv 3 2,992 Dec-10-2022, 10:36 PM
Last Post: bowlofred
  Python converted EXE not working Rajasekaran 1 2,966 Aug-22-2022, 05:56 PM
Last Post: hismail_sa
  check if a file exist on the internet and get the size kucingkembar 6 4,557 Apr-16-2022, 05:09 PM
Last Post: kucingkembar
  Pyinstaller distribution file seems too large hammer 4 6,313 Mar-31-2022, 02:33 PM
Last Post: snippsat
  Initializing, reading and updating a large JSON file medatib531 0 3,440 Mar-10-2022, 07:58 PM
Last Post: medatib531
  Converted Pipe Delimited text file to CSV file atomxkai 4 12,998 Feb-11-2022, 12:38 AM
Last Post: atomxkai
  Issue when using open() in converted exe skakalpes 2 2,941 Feb-02-2022, 02:42 PM
Last Post: snippsat
  numpy.dot() result different with classic computation for large-size arrays geekgeek 5 4,141 Jan-25-2022, 09:45 PM
Last Post: Gribouillis

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.