colabe image extract using pyton
# to read images and place content txt file, on 14th april 2025. result: good, but AI, needs to applied, doing it as raw.
# Step 1: Install necessary libraries
!pip install pytesseract Pillow
# Step 2: Import required modules
import pytesseract
from PIL import Image
import os
# Step 3: Define folder path (assuming your images are in '/content/images')
folder_path = '/content/images' # Adjust if your folder name is different
output_text_file = '/content/ocr_output.txt'
# Step 4: Create or clear the output file
with open(output_text_file, 'w') as f:
f.write("") # clear contents if any
# Step 5: Loop through all images in the folder
for filename in sorted(os.listdir(folder_path)):
if filename.lower().endswith(('.png', '.jpg', '.jpeg')):
image_path = os.path.join(folder_path, filename)
print(f"Processing: {filename}")
try:
img = Image.open(image_path)
text = pytesseract.image_to_string(img, lang='eng')
# Save to output file
with open(output_text_file, 'a') as f:
f.write(f"\n--- Text from {filename} ---\n")
f.write(text)
f.write("\n\n")
except Exception as e:
print(f"Error processing {filename}: {e}")
print(f"\n✅ OCR extraction completed. Output saved to: {output_text_file}")
result:
--- Text from s_1.jpg ---
‘Bandhan Small Cap Fund Direct Growth
ery High
ak» uty + a
IMiSmall Cap Fund Direct Growth
Very igh Risk = Equity = 2%
Invesco india Smallcap Fund Direct Growth
“Tata Small Cap Fund Direct Growth
Nippon india Small Cap Fund Direct Growth
Franklin India Smaller Companies Fund Dir
Very High Risk + Equty + 4%
Quant SmallCap Fund Direct Plan Growth
Very gh Risk = Equty + 5 *
HDFC SmallCap Fund Direct Growth
Bank of india Small Cap Fund Direct Growth
Edelweiss Small Cap Fund Direct Growth
LIC MF Small Cap Fund Direct Growth
Very igh Risk + Equty + 3%
‘Sundaram Small Cap Fund Direct Growth
Very igh Risk = Equity » 2%
‘Axis Small Cap Fund Direct Growth
Very High isk + Equity + 3%
HS8C Small ap Fund Direct Growth
ICICI Prudentiat Smalicsp Fund Direct Plan Growth
172%
5.05%
12%
4.80%
asa%
203%
783%
295%
469%
281%
607%
059%
581%
270%
-1at%
23.84%
291%
2059%
19.97%
19.28%
12.68%
17.75%
702%
16.08%
167%
15.97%
15.55%
121%
15.20%
14.71%
36.60%
178%
ager
6.10%
920%
a50%
48.50%
38.20%
627%
28.98%
a
--- Text from s_2.jpg ---
a
&
@
ct Growth
M1 Smal Cap Fund Di
Invesco india Smallcap Fund Direct Growth
Tata Small Cap Fund Direct Growth
Nippon india Small Cap Fund Direct Growth
Franklin India Smaller Companies Fund Direct Growth
Quant Small Cap Fund Direct Plan Growth
HDFC Small Cap Fund Direct Growth
Bank of India Small Cap Fund Direct Growth
Edelweiss Small Cap Fund Direct Growth
LIC MF Small Cap Fund Direct Growth
‘Sundaram Small Cap Fund Direct Growth
‘xis Small Cap Fund Direct Growth
HSBC Small Cap Fund Direct Growth
ICICI Prudential Smaliesp Fund Direct Plan Growth
Aditya Birla Sun Life Nifty Smalleap 60 Index Fund Direct Growth
5.05%
212%
4.80%
93%
203%
783%
295%
469%
281%
607%
063%
551%
276%
“141%
1.06%
201%
2059%
19.97%
19.20%
18.68%
775%
702%
16.88%
167%
15.97%
15.55%
18.21%
15.20%
14.71%
14.60%
--- Text from s_3.jpg ---
Invesco India Smallcap Fund Direct Growth
Tata Small Cap Fund Direct Growth
Nippon india Small Cap Fund Direct Growth
Franklin India Smaller Companies Fund Direct Growth
(Quant Small Cap Fund Direct Plan Growth
HDFC Small Cap Fund Direct Growth
Bank of India Small Cap Fund Direct Growth
Edelweiss Small Cap Fund Direct Growth
LIC MF Small Cap Fund Direct Growth
‘Sundaram Small Cap Fund Direct Growth
‘Axis Small Cap Fund Direct Growth
HSBC Small Cap Fund Direct Growth
ICICI Prudential Smallesp Fund Direct Pan Growth
Aditya Birla Sun Life Nifty Smallcap 50 Index Fund Direct Growth
‘Axis Nifty Smallcap 50 Index Fund Direct Growth
8.12%
4.80%
083%
203%
789%
298%
4.69%
281%
607%
069%
58%
270%
141%
1.06%
“155%
20.53%
34.98%
26.10%
920%
3a50%
26.27%
38.90%
ma%
78%
152%
873%
3a66%
25
--- Text from s_4.jpg ---
Tata Small Cap Fund Direct Growth
Nippon india Small Cap Fund Direct Growth
Franklin India Smaller Companies Fund Direct Growth
(Quant Smal Cap Fund Direct Plan Growth
HDFC Small Cap Fund Direct Growth
Bank of India Small Gap Fund Direct Growth
Edelweiss Small Cap Fund Direct Growth
LIC MF Small Cap Fund Direct Growth
‘Sundaram Small Cap Fund Direct Growth
‘Axis Small Cap Fund Direct Growth
HBC Small Cap Fund Direct Growth
ICICI Prudential Smaliesp Fund Direct Plan Growth
Aditya Birla Sun Life Nifty Smalleap 60 Index Fund Direct Growth
‘Ais Nifty Smallcap 50 Index Fund Direct Growth
‘S81 Small Cap Fund Direct Growth
480%
os3%
203%
783%
298%
4.69%
281%
07%
069%
581%
“270%
“141%
“1.06%
“1.55%
025%
19.97%
19.28%
12.68%
775%
702%
16.08%
167%
1597%
15.20%
14.71%
14.60%
14.58%
14.20%