<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ravi Verma</title>
    <description>The latest articles on DEV Community by Ravi Verma (@pkdventures).</description>
    <link>https://dev.to/pkdventures</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4190180%2F0a26ea15-b85c-4f4e-bafd-870067c0a7f2.png</url>
      <title>DEV Community: Ravi Verma</title>
      <link>https://dev.to/pkdventures</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pkdventures"/>
    <language>en</language>
    <item>
      <title>Clean Product Cut-Outs: A Practical Guide to Background Removal for Catalogues and Marketplaces</title>
      <dc:creator>Ravi Verma</dc:creator>
      <pubDate>Sat, 17 Oct 2026 11:22:36 +0000</pubDate>
      <link>https://dev.to/pkdventures/clean-product-cut-outs-a-practical-guide-to-background-removal-for-catalogues-and-marketplaces-7c0</link>
      <guid>https://dev.to/pkdventures/clean-product-cut-outs-a-practical-guide-to-background-removal-for-catalogues-and-marketplaces-7c0</guid>
      <description>&lt;h2&gt;
  
  
  How automatic background removal works
&lt;/h2&gt;

&lt;p&gt;Modern background removers use a &lt;strong&gt;segmentation model&lt;/strong&gt;, a neural network trained to decide which pixels belong to the subject and which belong to everything else. Background pixels become transparent, and the result is saved as a PNG, because PNG has an alpha channel and JPG doesn't.&lt;/p&gt;

&lt;p&gt;The model judges edges, shapes, colour and context together. That's why it handles irregular outlines much better than a "magic wand" selection. It's also why the input photo matters so much: the model can only separate what the camera actually captured as separate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Shoot for the cut-out, not the final image
&lt;/h2&gt;

&lt;p&gt;Most messy edges are decided at capture time. A few habits make the biggest difference:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Contrast between subject and background.&lt;/strong&gt; A white mug on a white sheet is a hard case. Put light products on a darker backdrop and dark products on a lighter one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Even, soft lighting.&lt;/strong&gt; Hard shadows on the backdrop can be read as part of the product. Shoot near a window on an overcast day, or bounce light off a wall.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Space behind the product.&lt;/strong&gt; Pull the product a little away from the backdrop so it doesn't cast a shadow right against it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sharp focus.&lt;/strong&gt; Motion blur and soft focus make edges ambiguous.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enough resolution.&lt;/strong&gt; A tiny thumbnail gives the model little detail to work with.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One subject per photo.&lt;/strong&gt; Overlapping products, or products sitting on top of similar-coloured props, are much harder to separate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some materials are hard for any automatic tool: fine flyaway hair, transparent glass, thin wires and reflective surfaces. Plan for a manual touch-up on those.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Remove the background
&lt;/h2&gt;

&lt;p&gt;For one-off images or a small batch, the free &lt;a href="https://pkdventures.in/tools/background-remover" rel="noopener noreferrer"&gt;PKD Ventures Background Remover&lt;/a&gt; takes a JPG, PNG or WEBP image and returns a transparent PNG. It uses an AI model to separate the product from the background. The first image can take a little longer while the model loads, and later ones are faster. Very large images can be slow on older phones.&lt;/p&gt;

&lt;p&gt;If the source photo is small or soft, upscale it &lt;strong&gt;before&lt;/strong&gt; removing the background. The &lt;a href="https://pkdventures.in/tools/image-enhancer" rel="noopener noreferrer"&gt;Image Enhancer&lt;/a&gt; uses the Real-ESRGAN model to enlarge images 2X, 4X or 8X. Keep expectations realistic: it reconstructs plausible detail but can't recover detail that was never captured.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Inspect the edges
&lt;/h2&gt;

&lt;p&gt;Don't judge a cut-out against a white page, because white hides a light halo. Preview it against a dark colour and then a bright one. Look for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a thin fringe of the old background colour around the edges,&lt;/li&gt;
&lt;li&gt;missing chunks where the product matched the backdrop,&lt;/li&gt;
&lt;li&gt;leftover patches of shadow under the product.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Small fringes can usually be fixed in any photo editor with a slight edge contract or a soft eraser. If you see big missing chunks, it's usually quicker to reshoot with better contrast than to repair the image.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Keep a transparent master, then export per destination
&lt;/h2&gt;

&lt;p&gt;Treat the transparent PNG as your &lt;strong&gt;master file&lt;/strong&gt;. You can always flatten it onto any background later, but you can't get transparency back out of a JPG.&lt;/p&gt;

&lt;p&gt;From that master you can export:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Transparent PNG or WEBP&lt;/strong&gt; for websites, slide decks and composites where the product sits on a designed background.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;White-background JPG&lt;/strong&gt; for catalogues and marketplace main images.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Brand-colour versions&lt;/strong&gt; for profile photos and social posts, with everyone on the same colour so a team page looks unified.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One shortcut for white backgrounds: the &lt;a href="https://pkdventures.in/tools/image-compressor" rel="noopener noreferrer"&gt;Image Compressor&lt;/a&gt; fills transparent areas with white when you choose JPG output. Choose WEBP or PNG output instead if you want to keep the transparency. You can also set quality and a maximum width to shrink phone photos.&lt;/p&gt;

&lt;p&gt;If you prefer the command line, ImageMagick does the same flattening:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Flatten a transparent PNG onto pure white and save as JPG&lt;/span&gt;
magick product.png &lt;span class="nt"&gt;-background&lt;/span&gt; white &lt;span class="nt"&gt;-alpha&lt;/span&gt; remove &lt;span class="nt"&gt;-alpha&lt;/span&gt; off product.jpg

&lt;span class="c"&gt;# Check the colour of the top-left pixel (should be white for a white-background image)&lt;/span&gt;
magick product.jpg &lt;span class="nt"&gt;-format&lt;/span&gt; &lt;span class="s2"&gt;"%[pixel:p{0,0}]&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; info:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 5: Check the destination's rules
&lt;/h2&gt;

&lt;p&gt;Every marketplace publishes its own image guidelines, and they change, so read the current version for each platform you sell on instead of relying on memory. Typical rules cover background colour, how much of the frame the product fills, minimum image size, and whether text, logos or props are allowed in the main image.&lt;/p&gt;

&lt;p&gt;Amazon is a common example. Its main product image is expected to be on a pure white background (RGB 255, 255, 255), with no added text or graphics. "Looks white" isn't always enough. A light-grey backdrop straight from the camera can fail this check, so a flattened cut-out is often the more reliable route. The pixel check above is a quick way to confirm.&lt;/p&gt;

&lt;p&gt;WhatsApp Business catalogues are more relaxed, but the same background, framing and canvas size across products still makes a small catalogue look organised.&lt;/p&gt;

&lt;h2&gt;
  
  
  A repeatable routine
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Shoot every product against the same contrasting backdrop, in the same light, from the same angle.&lt;/li&gt;
&lt;li&gt;Upscale any small or soft photos first.&lt;/li&gt;
&lt;li&gt;Remove backgrounds in one sitting and check edges against dark and light previews.&lt;/li&gt;
&lt;li&gt;Save transparent PNG masters, named by product code.&lt;/li&gt;
&lt;li&gt;Export per destination: white JPG, transparent WEBP or a brand-colour version.&lt;/li&gt;
&lt;li&gt;Compress and resize before uploading, then spot-check against each platform's current rules.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Closing note
&lt;/h2&gt;

&lt;p&gt;This guide comes from PKD Ventures, a Kanpur-based company that builds websites, business apps and custom software. We also keep a set of free tools for everyday image and file jobs at &lt;a href="https://pkdventures.in" rel="noopener noreferrer"&gt;pkdventures.in&lt;/a&gt;. If your store handles hundreds of product photos a week, it's usually worth building background removal and resizing into the upload pipeline itself, so every new image comes out consistent without any manual steps.&lt;/p&gt;

</description>
      <category>ecommerce</category>
      <category>productivity</category>
      <category>tools</category>
      <category>images</category>
    </item>
    <item>
      <title>Scanned PDF or Text PDF? A Practical Guide to Getting Text Out (Including Hindi and Urdu OCR)</title>
      <dc:creator>Ravi Verma</dc:creator>
      <pubDate>Sat, 17 Oct 2026 10:35:40 +0000</pubDate>
      <link>https://dev.to/pkdventures/scanned-pdf-or-text-pdf-a-practical-guide-to-getting-text-out-including-hindi-and-urdu-ocr-504k</link>
      <guid>https://dev.to/pkdventures/scanned-pdf-or-text-pdf-a-practical-guide-to-getting-text-out-including-hindi-and-urdu-ocr-504k</guid>
      <description>&lt;p&gt;Sooner or later someone hands you a PDF and asks you to "just pull the text out". Maybe it's a vendor contract you need to diff, a stack of scanned forms you want to search, or an old Urdu notice someone needs retyped. Whether this takes two seconds or an afternoon depends on one question: does the PDF actually contain text?&lt;/p&gt;

&lt;p&gt;This post walks through how to answer that question, which approach to use for each case, and the small habits that make OCR output far less painful to clean up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Find out what kind of PDF you have
&lt;/h2&gt;

&lt;p&gt;PDFs come in two broad flavours:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Text PDFs&lt;/strong&gt; are exported from Word, Google Docs, LaTeX, a reporting tool, and so on. The characters are stored as real text with fonts attached.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Image PDFs&lt;/strong&gt; come out of scanners and phone scanner apps. Every page is basically a picture. There's nothing to extract until something reads the picture.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The lazy check is to open the file and Ctrl+F for a word you can see. If search finds it, there's a text layer.&lt;/p&gt;

&lt;p&gt;If you're on the command line, &lt;code&gt;poppler-utils&lt;/code&gt; gives you a more reliable signal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Lists the fonts embedded in the PDF.&lt;/span&gt;
&lt;span class="c"&gt;# An empty table usually means the pages are images (a scan).&lt;/span&gt;
pdffonts document.pdf

&lt;span class="c"&gt;# Try a direct extraction and see if anything meaningful comes out.&lt;/span&gt;
pdftotext &lt;span class="nt"&gt;-layout&lt;/span&gt; document.pdf - | &lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-40&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Watch out for mixed files. A scanned contract with a typed cover page will show fonts, but only page 1 has text. If you're processing a batch, check per page instead of per file (&lt;code&gt;pdftotext -f 3 -l 3&lt;/code&gt; extracts just page 3).&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: For text PDFs, skip OCR entirely
&lt;/h2&gt;

&lt;p&gt;If the text layer exists, use it. Running OCR on a perfectly good text PDF is slower and less accurate than reading the characters that are already there.&lt;/p&gt;

&lt;p&gt;A few things to expect:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Line breaks are visual, not semantic.&lt;/strong&gt; PDFs store positioned lines, so a paragraph often comes out as several hard-wrapped lines. Most extractors try to rejoin them, but you'll still see odd breaks around hyphens and headings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-column layouts can interleave.&lt;/strong&gt; Two columns may come out mixed line-by-line. &lt;code&gt;pdftotext -layout&lt;/code&gt; keeps the columns side by side, which is often easier to fix by hand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tables flatten.&lt;/strong&gt; Plain-text extraction drops cell borders, so a table turns into rows of words separated by spaces.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you just need the wording in a usable format, a plain &lt;code&gt;.txt&lt;/code&gt; (UTF-8) is the most portable target. If someone non-technical has to edit it afterwards, a &lt;code&gt;.docx&lt;/code&gt; is friendlier. For a quick conversion without installing anything, I've used the &lt;a href="https://pkdventures.in/tools/pdf-to-txt" rel="noopener noreferrer"&gt;PDF to TXT tool&lt;/a&gt; for plain UTF-8 output and the &lt;a href="https://pkdventures.in/tools/pdf-to-word" rel="noopener noreferrer"&gt;PDF to Word converter&lt;/a&gt; when the result needs to land in Word or Google Docs. Both extract text only, so layout, tables and images aren't recreated. That's the honest trade-off with any text-extraction approach.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: For scans, OCR is the only way in
&lt;/h2&gt;

&lt;p&gt;Once you've confirmed the pages are images, you need optical character recognition. Tesseract is the usual open-source engine, and the CLI workflow looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Render pages to images at 300 DPI&lt;/span&gt;
pdftoppm &lt;span class="nt"&gt;-r&lt;/span&gt; 300 &lt;span class="nt"&gt;-png&lt;/span&gt; scan.pdf page

&lt;span class="c"&gt;# OCR each page (eng, hin and urd are Tesseract's codes&lt;/span&gt;
&lt;span class="c"&gt;# for English, Hindi and Urdu; install the language data first)&lt;/span&gt;
&lt;span class="k"&gt;for &lt;/span&gt;f &lt;span class="k"&gt;in &lt;/span&gt;page-&lt;span class="k"&gt;*&lt;/span&gt;.png&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
  &lt;/span&gt;tesseract &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$f&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;f&lt;/span&gt;&lt;span class="p"&gt;%.png&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; urd
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two settings matter more than anything else here.&lt;/p&gt;

&lt;h3&gt;
  
  
  Resolution
&lt;/h3&gt;

&lt;p&gt;Low-resolution renders destroy small text. Around 300 DPI is the commonly recommended target for printed text. Below that, thin strokes and dots start to merge, and accuracy drops off quickly. Complex scripts suffer the most. Urdu in Nastaliq has diacritic dots and joined letter shapes that just disappear at low DPI.&lt;/p&gt;

&lt;h3&gt;
  
  
  Language
&lt;/h3&gt;

&lt;p&gt;OCR engines don't read "all writing" at once. They load a model for one script and language. Run English OCR on a Hindi page and you get a scatter of Latin characters, because the engine is hunting for letters that aren't there. Switch to &lt;code&gt;hin&lt;/code&gt; and the same page becomes readable Devanagari.&lt;/p&gt;

&lt;p&gt;If a page mixes scripts, for example English headings over Hindi body text, pick the language that covers most of the text. Tesseract can also take combined languages (&lt;code&gt;-l hin+eng&lt;/code&gt;), but expect it to be slower.&lt;/p&gt;

&lt;p&gt;Urdu has one more catch: it's written right to left. If you paste OCR output into an editor that assumes left-to-right, punctuation and numbers can look scrambled even when the recognition itself was fine. Check the paragraph direction before blaming the OCR.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Improve the input, not the engine
&lt;/h2&gt;

&lt;p&gt;Most "bad OCR" is really a bad scan. Before you tweak engine settings, fix the source:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Flatten and straighten the page.&lt;/strong&gt; Skewed lines and curled book pages break line detection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use even lighting&lt;/strong&gt; for phone scans. Shadows across the page and glare on glossy paper hide characters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Avoid copies of copies.&lt;/strong&gt; Every photocopy generation loses contrast, so scan the original if you have it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Crop out the clutter.&lt;/strong&gt; Fingers, desk edges and dark borders add noise the engine tries to read.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test a few pages first.&lt;/strong&gt; On a long document, OCR two or three representative pages, check the quality, then run the rest.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 5: Proofread the parts that matter
&lt;/h2&gt;

&lt;p&gt;Even on a clean scan, OCR confuses similar shapes: &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;O&lt;/code&gt;, &lt;code&gt;1&lt;/code&gt; and &lt;code&gt;l&lt;/code&gt;, &lt;code&gt;rn&lt;/code&gt; and &lt;code&gt;m&lt;/code&gt;. Before you trust the output, spend your proofreading time where mistakes are costly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Names, amounts, dates and ID numbers&lt;/li&gt;
&lt;li&gt;Headlines and anything set in a decorative font&lt;/li&gt;
&lt;li&gt;Handwriting, which general-purpose OCR doesn't recognise reliably&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're piping OCR output into code, validate the fields you care about (dates parse, totals add up, IDs match their expected format) rather than assuming the text is correct.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick decision checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;pdffonts&lt;/code&gt; shows fonts and &lt;code&gt;pdftotext&lt;/code&gt; returns real words? → Extract directly, no OCR.&lt;/li&gt;
&lt;li&gt;Empty font table, or garbage text? → It's a scan. Render at around 300 DPI and OCR it.&lt;/li&gt;
&lt;li&gt;Non-English text? → Set the OCR language explicitly (&lt;code&gt;eng&lt;/code&gt;, &lt;code&gt;hin&lt;/code&gt;, &lt;code&gt;urd&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Output looks scrambled in Urdu? → Check right-to-left paragraph direction first.&lt;/li&gt;
&lt;li&gt;Huge file? → Test a few pages before running the full batch.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Closing note
&lt;/h2&gt;

&lt;p&gt;I put this together while working on document tools at PKD Ventures, a Kanpur-based company that builds websites, business apps and custom software. We also keep a set of free tools for everyday file jobs like these at &lt;a href="https://pkdventures.in" rel="noopener noreferrer"&gt;pkdventures.in&lt;/a&gt;. If your team handles a steady stream of scanned forms or invoices, it's usually worth going beyond one-off conversion to proper field extraction and validation. Either way, getting Step 1 right will save you the most time.&lt;/p&gt;

</description>
      <category>pdf</category>
      <category>ocr</category>
      <category>productivity</category>
      <category>tools</category>
    </item>
  </channel>
</rss>
