Detect Text in Newspaper Images with Feluda
This example demonstrates how to use the DetectTextInImage operator to extract text
from newspaper images. It processes multiple newspaper clippings and displays the
detected text with proper formatting and analysis.
Install dependencies conditionally based on whether the notebook is running in Colab or locally.
%%time
import sys
IN_COLAB = "google.colab" in sys.modules
print("Running Notebook in Google Colab" if IN_COLAB else "Running Notebook locally")
if IN_COLAB:
# Since Google Colab has preinstalled libraries like tensorflow and numba, we create a folder called feluda_custom_venv and isolate the environment there.
# This is done to avoid any conflicts with the preinstalled libraries.
%pip install uv
!mkdir -p /content/feluda_custom_venv
!uv pip install --target=/content/feluda_custom_venv --prerelease allow feluda feluda-detect-text-in-image-tesseract > /dev/null 2>&1
sys.path.insert(0, "/content/feluda_custom_venv")
else:
!uv pip install feluda feluda-detect-text-in-image-tesseract opencv-python matplotlib > /dev/null 2>&1
Running Notebook locally
Using Python 3.10.12 environment at: /home/aatman/Aatman/Tattle/feluda/.venv
Audited 6 packages in 11ms
CPU times: user 6.38 ms, sys: 4.13 ms, total: 10.5 ms
Wall time: 138 ms
We’ll use one operator for this example, for detecting text from newspaper clippings. Let’s initialize the operator.
from feluda.factory import ImageFactory
from feluda.operators import DetectTextInImage
detector = DetectTextInImage(psm=6, oem=1)
Warning: Some required language packs are not installed: hin, tam, tel
OCR may not work correctly for these languages.
Image links for the newspaper-clippings
newspaper_image_links = [
"https://github.com/tattle-made/feluda_datasets/blob/main/feluda-sample-media/newspaper-clipings/news1.png",
"https://github.com/tattle-made/feluda_datasets/blob/main/feluda-sample-media/newspaper-clipings/news2.png",
"https://github.com/tattle-made/feluda_datasets/blob/main/feluda-sample-media/newspaper-clipings/news3.png",
"https://github.com/tattle-made/feluda_datasets/blob/main/feluda-sample-media/newspaper-clipings/news4.png",
"https://github.com/tattle-made/feluda_datasets/blob/main/feluda-sample-media/newspaper-clipings/news5.png",
"https://github.com/tattle-made/feluda_datasets/blob/main/feluda-sample-media/newspaper-clipings/news6.png",
"https://github.com/tattle-made/feluda_datasets/blob/main/feluda-sample-media/newspaper-clipings/news7.png",
]
Download each image and extract text using the operator
results = []
for i, image_url in enumerate(newspaper_image_links, 1):
print(f"Processing image {i}/{len(newspaper_image_links)}...")
try:
# Convert GitHub blob URL to CDN raw URL for direct download
raw_url = image_url.replace("/blob/", "/raw/")
# Download image using ImageFactory
image_obj = ImageFactory.make_from_url_to_path(raw_url)
# Extract text using the detector
detected_text = detector.run(image_obj, remove_after_processing=True)
# Store results
result = {
"image_number": i,
"url": image_url,
"text": detected_text.strip(),
"text_length": len(detected_text.strip()),
"word_count": len(detected_text.split())
if detected_text.strip()
else 0,
}
results.append(result)
print(
f"✓ Extracted {result['text_length']} chars, {result['word_count']} words"
)
except (FileNotFoundError, RuntimeError, ValueError) as e:
print(f"✗ Error processing image {i}: {e}")
continue
Processing image 1/7...
Downloading image from URL
Image downloaded
✓ Extracted 2345 chars, 421 words
Processing image 2/7...
Downloading image from URL
Image downloaded
✓ Extracted 4036 chars, 587 words
Processing image 3/7...
Downloading image from URL
Image downloaded
✓ Extracted 2983 chars, 493 words
Processing image 4/7...
Downloading image from URL
Image downloaded
✓ Extracted 1814 chars, 308 words
Processing image 5/7...
Downloading image from URL
Image downloaded
✓ Extracted 668 chars, 120 words
Processing image 6/7...
Downloading image from URL
Image downloaded
✓ Extracted 3152 chars, 523 words
Processing image 7/7...
Downloading image from URL
Image downloaded
✓ Extracted 1449 chars, 273 words
Display the results neatly.
def display_results(results: list[dict]) -> None:
"""Display the results of text detection in a formatted manner.
"""
if not results:
print("No images were successfully processed.")
return
# Summary statistics
total_images = len(results)
total_characters = sum(r["text_length"] for r in results)
total_words = sum(r["word_count"] for r in results)
print(
f"\nSUMMARY: {total_images} images, {total_characters:,} chars, {total_words:,} words"
)
print(
f"Average: {total_characters // total_images if total_images > 0 else 0:,} chars/image, {total_words // total_images if total_images > 0 else 0:,} words/image"
)
# Detailed results for each image
for result in results:
print(f"\n--- IMAGE #{result['image_number']} ---")
print(f"URL: {result['url']}")
print(f"Stats: {result['text_length']} chars, {result['word_count']} words")
print("DETECTED TEXT:")
if result["text"]:
# Display text with proper formatting
lines = result["text"].split("\n")
for line in lines:
if line.strip(): # Only print non-empty lines
print(line.strip())
else:
print("(No text detected)")
display_results(results)
SUMMARY: 7 images, 16,447 chars, 2,725 words
Average: 2,349 chars/image, 389 words/image
--- IMAGE #1 ---
URL: https://github.com/tattle-made/feluda_datasets/blob/main/feluda-sample-media/newspaper-clipings/news1.png
Stats: 2345 chars, 421 words
DETECTED TEXT:
ter source after a long wait
Authorities dig a c a ou Sistas
borewell after cs) fe | ae Ws yt, ;
——. CAT
an RTI query So oat ar Reo 3
SIDHARTH YADAV P wa? | |
BHOPAL se Ait aN , t elo
Taunts, casteist slursandbo- }} \e ‘ \s am. {3
rewell motor being turned ) 3) my
off at whim by upper-caste
households have haunted
members of a Dalit settle- Tough journey: The group took turns to fetch water from
ment ata village in Rewa dis- _ private borewells over a kilometre away. «SPECIAL ARRANGEMENT
trict for 20 years. Buta Right
to Information (RTI) query _ source, closer to them. When the department
has got them a borewell dug “We even approached the didn’t respond, he first ap-
— a water source they can fi- local MLA... he isa messiah proached the first appellate
nally call their own. of only seeking votes from authority, and then the In-
At the Nevaria settlement us. Shivanand bhai is our formation Commissioner
in Gangeo block, around100 real messiah ashe sentsome Rahul Singh, who on June 2
members of Dalit families papers over WhatsApp to called for a hearing via
took turns, mostly girls and _ some official and got the job + WhatsApp video call two
women, to fetch water from done,” said Mr. Saket. days later.
handpumps and private bo- Shivanand Dwivedi, a so- The night before the hear-
rewells controlled by upper cial worker, sent to the dis- ing on June 4, authorities
caste Mahajans more than a __ trict Public Health Engineer- reached the settlement and
kilometre away. ing Department an RTI dug the borewell. “They told
“The only route passed query, seeking information me during the conference
through their fields and you on the action taken to diga__ the borewell has been dug,”
can’t cross them half the borewell in the settlement. said Mr. Singh. The officials
year as they are ploughed As the matter pertained to _ were not fined for not pro-
and crops cultivated,” said the life and liberty of per- _ viding information within 48
Krishna Saket, 21, a resident sons, he contended authori- hours. “Staff crunch and li-
of the settlement. Since ties had to provide the infor- mited resources due to the
2017, the group has been de- mation within 48 hours lockdown probably caused
manding the government under section 7(1) of the RTI _ the delay in the response,”
provide for a separate water Act, 2005. said Mr. Singh.
--- IMAGE #2 ---
URL: https://github.com/tattle-made/feluda_datasets/blob/main/feluda-sample-media/newspaper-clipings/news2.png
Stats: 4036 chars, 587 words
DETECTED TEXT:
Howa people's barrage Saves
water, improves farmers lives
Sometimes combating farm distress can be a simple matter of asserting one’s right to
water, as farmers in jamkhandi in Karnataka’s Bagalkot district proved with their
experiment in water management. Now, those behind ‘India's first people's barrage’ are
looking to share the benefits with fellow cultivators in other distressed areas
——
— Do : oe aed
= | = NO RESPONSE FROM GOVT
S } Fy sae govt kat going demands
a) = Samomattendoones et
= Janktunditarabarape sre 965
nl y SS) © > 111980, farmers grouped to form
Farmer Guappa Baer ight ofthe Sangha sande, he Krbbna Tea Raat Samba
GOING TT ALONE WATERARIGHT BOUNTY OF THE BARRAGE
> 1n 1983, farmers started MAKE INDIA > Govtomosed — Sugarcane yield jumped» Farmland price per
work onthe barrage on = PD enetrcton then dere ret SLL
Se” WATER SSE im a SSS
‘pibver wae. Pret cost mS ett; _
Sani tere §=— POSITIVE famestwvated yet
Served abou tito aeres = onl et
Sratemeteeter | ATaasorman mann | OOrsmove Srekingater
vere mig ener toveesteontol frombarage
‘Radhe shyam.tachay ing government's opposition, but ust stopping spillover The of Balwadi and Tandulwadi
gmean Rehaituikatemgr met wawerranwouliewast Sondre a smal trey
Spllorer of the Rruhiwew ed"sayeSanghapresientRa naming it Beliraja Stati
can waiver is notamas ters and turned over 15000 endraPatl Construction of Dharan: However the move
[Sihaie'Shower'e the Soewsterrenlandingsyt the mlong barrage was ent aed ot oer die
Ltgurim crsisandiarm lage ingot paces Today complet in ‘ens among ane But he
cevulrite: Governmentean Sunghatirmersarereayinga 1m 201344, the farmers experiment in neighbouring
‘othe frmersallthetsmn plat to share chotr water raid is beight by Lam ond Karnataka urabe.
‘rebmetohdpourves’aye with farmers in drought: intel 23puapsrtsot HDHE "Gowrtanetswerkingon
Sreanpnuranurpa Sinced\Viapapia it When ia rnaranaraltow slawianeriaastntae
eat amin in Cobelp irrigate thelr land, reduces afer morscon, pump concrete plana Were adding
Nas Rogalot district where ll ponds and lakes and steareused oi wate oto farmers Vigepura tou
raledtvacrsiiehinhae riscthegroundwatertabie, Ow reorvok: Abou TMC Sangha anysSh{Curuser
Gimdamaiutewlitionto "When thefarmers started (ovsand milion cubic et) At present, about 5,000
Ermer wowihiniwsft wdragatinirieigy awqantestraimiene tin Buea asc
fopkistarrage, tal acres —rapn gnermment yok Vjgopwafirnerswil arebenedldng fom
‘theriver Krishna, asked them toraiseftindscf Rs gettheirsupplyviadirect pipe rage water with 2,003,000
"vile poliiclne in the iSimh'Taemoneyvasraied ineeand mor punpetofll mae lrmere er Vigor
state squabble oer the pro. through voluntary contriu- Idkeandartiici pooda’-"” expeetnitoteatdediottht,
PuedResesocore tian onsfuniarmstaanscves Alsi Uw ils asinar "Adds Pail, "We've con:
Sawer Gurappe and ther butgovernman continued to effort was made im Khanapur troled th fw ef wae ere
Imiersof farmery secs tqpeesnnlingmssollow taka in Afabarashira wire shopped any interfeen
ConkrstnwTherafuyatSing consuctonot thebarrage farmers ite under the Sho by various government We
Inneeworkngonanambiiogs lfillyreeniadandvork shtShetriachtlariKam- manage malstmanoe and oy
‘huntomakoallfrmersinthe on the barrage at Chikiapa- gar Mukti Sanghersh chim erectswith irmary conte
agon detti They blvve’ dastagi finaly oko "We | Fghtover the teria atu tons With ample water, the
Gntrihitomter Bthesolt arenotoddingfow ot water, Uo rver Kirsh Vilas rgionseconey hw ange,
Unoatopfumee ated ‘Now wo want to elp farms
contol agrarian risie The | BE A TOI CHANGE LEADER... ina da
‘Sangha contralsthefow of «3 w+. not enough to simply reflect, take action today! arena ata
cape; mama vaneng | Koriase eareartoke te tlcaamelaaanrs sae | Dugg mart an anos
thrwarie which dy hase | your waterconservation stry on our Facebook page. Use | ers sr four wheelers. Once
‘ined Shram BindiSaga’ | fashtay soeWaterPost ‘Seouphtaced and
Tathe Wels nowithsand owlowemssasigrcane bh
TOI FORMORE INFOGRAPHICS DOWNLOAD Gis aw 2
--- IMAGE #3 ---
URL: https://github.com/tattle-made/feluda_datasets/blob/main/feluda-sample-media/newspaper-clipings/news3.png
Stats: 2983 chars, 493 words
DETECTED TEXT:
The world’s highest, and t
€ worids highest, and mos
reckless, user of groundwater
Itis the backbone of India’s drinking water and irrigation supply systems, but overexploitation of
‘groundwater isa threat to not only our food security but also the stability of the land, say's
Radheshyam Jadhav in the third of the series for TOI's Water Positive campaign
<< —<—<—<—<—<—<—_—<$———
as on 7" ;
toour useof groundwater. % % %
hilly Becauseinower | of nda dink ofwaterfor of thetotaladtionto of nda’ face
rradamediconearig ing water needs irrigation irrigation over the last groundwater over-
ime rising more than just | cngerten’ — Sagedby feurdeagstascone explotaton andor
ease Geommdwase | oundwater ‘groundwater from groundwater serous qualty issues
Casek er
pe cc Sa a
‘ty of the land. WELLS IN BAD HEALTH ‘Sete neh wats dew
Land subsidence due t0 | , comparison of 2017 pre-monscon water levels withthe 10-¥earaeg 2007-100
cramer penpiging | Rematen of 7 one nono rie a
problem threatening several a oe breseans a ing olive [below ag,
wince Bing lar = |
ta, Dhaka, Bangkok, Ho Chi Y aia Lec MEE
Minn i chappal e 4 i 46 | 355
Uhotevettoshaveal et \ as — alas
ay
predict that Tafa cite we: 60.7% Wad ma) 87
too, are Iikely to face land Set ‘3 Karnataka 93| 267
eet eee =a
‘tion of groundwater contin- 2 Haryana oes) aL
and subsidence and me ee oe eae
ground rupture can signif Chattisgarh aa) 166
Se coer os wz) 7
imag eyo ee
le. Cases of land subsit- | 756 Cont Sa)
ence in western countries of these below avg by 2m or more Jharkhand sez; us
Geieti acne | -amamenscovemnamassee =
ly, Houston tn US) and in ian babreshiva W968) Vel
supply of potable water LULU Sedstrspeertr-papt Sitsdencels Sen
lee
ind —— 7
‘scientist Pietro Teatini land MAKE INDIA BE A TO! CHANGE LEADER...
SS ti Its not enough to simply reflect, take action today!
of Bengal, sch asthe dltate WATER ‘Nominate yourself tobe the TO! Change Leader —
veoora aekabnads Ge — FX | She your nag water conserva story oa our
wart krstaandCaniery OS | T | VV E | Factbookpage.Usehashtag #BeWaterPostve,
feng hess vitisiing | ATonesor soi rsriaive_ | REMEmber every drop counts
ES eregerrerrerer
ee SS Sees ere
Ein canoe Gnuumtewss faesccuaroas jeune capers
EueGetae. lcuugoatemat Geasecwe hier Seuegodtese
Eectcnitints widmiciearoies spromndtageat wasiead i antiae
CEH oee Onakeauaee ” Seowbemeaetecd | funetstesdoutens
Yacr ume itan ee of “OftsiasweisOown framvacrconaniaien forte te ube a
Lune ante ces Somme anda mmaenetaty
Ground Weler Bout Gwandtsanogives duces Tse oareis isiunere specie Oo
Cli naiensoes frome haar: Geucueats ieeun otecetieer
Co aculsce: Oiakamens Gattiotate werd ganceie
Gumansandsboutasbth groundwater lowed ty Seramestom rote yt pumpy more ah
Gispudensrace fupoiconascetes ““tmesot oisGuund meus ani Chim conned
Sot eloctaned wena “mecimantet
‘These 2017 pre-monsoon rise in water levels over the gion is the largest user of est users, respectively.
TOI FORMORE INFOGRAPHICS DOWNLOAD @ions aa a
--- IMAGE #4 ---
URL: https://github.com/tattle-made/feluda_datasets/blob/main/feluda-sample-media/newspaper-clipings/news4.png
Stats: 1814 chars, 308 words
DETECTED TEXT:
By a Special Reporter
. .
Parched inland areas will lack water even for
° . .
essential stock and domestic uses unless substantial
. .
rain falls in the next few months.
All inland river systems except those in the south-
ern Riverina are fast drying up.
One coastal river, the | has taken drastic steps to} duced to the lowest level
Hunter, is also drying up. | meet the great water) in their history.
Many rivers and creeks! crisis. | The State is relying on
without regulating stor-|, The end of water for) drenching winter rains and
ages have ceased to flow! ittigation purposes is im-| runoff from heavy snow to
and farm water storages|Minent on the Macquarie, | avert disaster, 3
vary from empty to only| Lachlan, Namoi and Hun-| Conservation Minister
partly full. ter Rivers and irrigation is| Beale, with officers of the
Major storage dams are| Testticted in most other Hered Cr Gonsetyae
; areas. ion ani ie Water Con-
po Seb seed ON cal Only a dramatic change | Soe, and Irrigation
are more than half empty.| {2 the. weather can Save} Commission, has tried to
PfY-| the irrigation dilemma. | counter the drought with
Controlled discharges Facing ruin failing | measures based ‘on weather
from these dams alone| really heavy falls are information and facts
keep our vast river ae thousands of graziers,| from men in the field,
tems flowing, or rather horticulturists, vegetable; Mr. Beale’s grim assess-
trickling. and cotton growers and|}ment is that unless sub-
These discharges are|others who rely on irri-| stantial rains fall, more
being restricted to urgent/gation water for their|than half our major
domestic, stock and irri-| survival Storage dams will be
gation needs, Water resources, in re-|empty by the end of Sep-
The State Government! lation to demand. are re-! tember. a
a y ~<S
--- IMAGE #5 ---
URL: https://github.com/tattle-made/feluda_datasets/blob/main/feluda-sample-media/newspaper-clipings/news5.png
Stats: 668 chars, 120 words
DETECTED TEXT:
| Heart of wet season |“
endsin state with
e Pa
big fears of drought *
Lo
By Kurtis Alexander year, the latest indication that
water supplies are tightening. E
Adisappointingly dry Feb- | With the end of the stormy
ruary is fanning fears of an- season approaching, forecast-
other severe drought in Cali- ers don’t expect much more
fornia, and cities and farms buildup of snow, a key compo- E
are bracing for problems. In nent of the statewide supply
many places, including parts that provides up to a third of one
of the Bay Area, water users California’s water. —
are already being asked to cut The impact is registering, =
back. Growers in the Central Valley =:
--- IMAGE #6 ---
URL: https://github.com/tattle-made/feluda_datasets/blob/main/feluda-sample-media/newspaper-clipings/news6.png
Stats: 3152 chars, 523 words
DETECTED TEXT:
THE TIMES OF INDIA, HYDER, D
WEDNESDAY, DECEMBER er
__ Vrought-hit farmers may lose —
land to diamond, gold explorers
: U.Sudhakarredd, Sear : ——— gee villagers cometo this area a
: @timesgroup.com E a ik Vk ee Ain search for diamonds during
: Le RO a RN ow ica ains. Weneed water re-
ke NNR Sec [Aa aera Ohicis Syne Eales firstrains. We lee .
: Anantapur (AP): Drought- Reto MIELE of nae Pana bee) sources and minimum sup-
' hit farmers of Andhra Pra. (RRSS eS Sea asi: [2 neat port price, We don’t want di- |
desh, who are already coun. [Ree SEES. do a er Baral Gel (we WNii|s| amond and gold mines,” he |
tng the pieces of a massive RAS one, SOT Ea > fete added. da
crop failure, could now end oes fc Q, <5 = Geomysore has secured —
UP losing their land to dia. PRN ORORES So SR ielee—wge | permission for mining in |
mond and gold explorers, Ls ees ee ———_ Mies) JonnagiriGoldmineoveran |
Farmers of the diamond Cera ee RSE Te | extent of 597.82 hectares in
belt of Anantapur and gold ie ale inner ee ose Jonnagiri, Pagardrayi and —
deposit region of Kurnool The toad leading to Vajrakarur, Pal ve te igre] Erragudi villages of Tugga- |
now liveinfearoflosingthe. | the diamond belt in Anantapur be eee | li Mandal of Kurnool dis- |
_ vey of India (GSI) announ- The diamond processing plant ae i ed It is estimated that The
; CedonDecember19thatthey | UN by Geological Survey of —_fssiz a Jonnagiri project, may pro- —
| discovered diamondiferous | |ndiain Vajrakarur ee RET sie | duce about 25 000 oz/y(Oun-
: Kimberlite rocks, which : ce per year) of gold which
: May contain diamonds in Mandal in Kurnool district, peracre,whichwastakenby will be quarter of India’s
: Vajrakarur in Anantapur India’s first private gold mi- the bank for interest. Theen- gold production. ;
: district. ne Geomysore Services In-_ tirelandisprivatepattaland Anantapur district re-
: GSlis already runninga dia Private Limited, has al- except for negligible par- corded-46.8 rainfall and Vaj- |
: diamond processing plant ready reachedfinalstagesof cels. Wearenotreadytogive rakarur mandal have -30.7
: Onan experimental basisin gold exploration, and is in “up ourlandfordiamondex- deficient rainfall. Tuggali
: Vajrakarur and have carri- the process of acquiring 350 ploration,” said G Bheem MandalinKurnoolrecorded
i ed out studies at Ramapu- acresof landfortheopenpit. Reddy, a farmer in Vajraka- -68.4 scanty rainfall.
: ram, a nearby village. Inci- "Out. of eight acres of rur. Jala Sadhana Samiti se-
: dentally, the state govern- groundnut crop, I got a yield JMRajuafarmerofGan- cretary M Ramakrishna sa-
: ment has already declared of 30kgperacre.Normalyi- jikunta of VajrakarurMan- id sowing of groundnut has
} 63 mandals in Anantapur eld shouldbefivetosix quin- dal explained how GSI has dropped from 20 lakh hecta- |
: district as drought-hit, in- talsbutIsufferedalossof Rs been working here for seve- restol0lakhhectares.Anan- |
: cluding Vajrakarur. llakh. The insurance claim ral years in Vajrakaru and tapur has been facing dro- —
t At Jonnagiri in Tuggali moneyIgotwasonlyRs1190 Rampur “A largenumberof ughtsince 2009.
--- IMAGE #7 ---
URL: https://github.com/tattle-made/feluda_datasets/blob/main/feluda-sample-media/newspaper-clipings/news7.png
Stats: 1449 chars, 273 words
DETECTED TEXT:
enewrpaper sition
ieee, coh kes FRIDAY, DECEMBER 15, 207
RETURN OF ‘RIDICULOUSLY RESILIENT RIDGE’?
La Nifia growing: Cooling water in equatorial Pacific often [eee cetcetere CREEPING BACK
means little rain in state, but a few storms could erase shortfall yup from 22 percent tree months a
— Sept. 12 Dee 12
‘waters near the equator th Prancseo history ack to isso. | 1) 1
perenne TER Lip treed the chances ie Serra Nevada snow pack, | Drought Ke4
ies Ores Nita ores to langues seteseunernar’ | Sot 1 UR)
Sere ais are beginning to Ahroug ie spring, federal scen- as mite down to percent of | cous’ vl
wonder: fs te sate heeding back tse sald Thora Ahistoric ever [iAteeraty .
Ino drought December has sofa brought al Mauseetiy warm, ry | 3 ~
cane exerts teens to with a0 sgnifeant storms freast gros Southern Califores, and deere
serine tne evidence is acca. Yor the next to weeks in the Bay Mrarnings fom the Na- | Bseerecroust
a eing and the min isdefintely Are, the month i on track to Des Service about in; | Mlesvene drought sa
moe ome the driest Deeember in San Mie risk this weekend in| SRS :
ina conditions inthe Pa- Jose history since records began eis thin weekend in | eseptonalcrougre =’ $ an,
cific Ocean — the cooling of ocean jn 1893 and the third driest in San "DROUGHT »PAGES | Souce:\S Drouwht Monitor
IMAGES CAPTUREPIVOTAL MOMENTIN .. a SEA CHANGEFOR INTERNET?
Pm see
b 4 Ac
| Al INO “st | | FCC votes
he aon) eae ¥ f 2
i Bh) | a &
Clean up the operator
detector.cleanup()