Grok Bot processes ID photos and PDFs and tests size limits, signatures and OCR
Overview
Online forms ask for different dimensions and file sizes, and phone photos and scans are often too large. The author avoids uploading documents to unfamiliar free converters, uses command-line tools on Grok Bot's cloud computer and checks each prompt on self-made test files.
Workflow
Trigger: Online forms each want slightly different files. For example, a photo of exactly 200×230 pixels between 20 and 50 KB, a PDF below 300 KB, or a scan that can actually be searched later. A phone produces a 2 MB photo and a scanning app a 4 MB PDF. A free converter wants those documents uploaded to an unfamiliar server. The author sends the work to Grok Bot, which can run real image and PDF tools on its cloud computer command line. Attach the file and specify the rules, and the bot returns a result and report. To verify the prompts, the author made realistic files. An image generator made three fictional phone photos, in daylight, dim evening light and landscape orientation, all stored like phone photos with rotation and location tags. The author laid known text out on A4 pages and simulated flatbed scans with paper grain, slightly skewed feeding, staples, punch holes, creases and rubber stamps. A statement page was also photographed at an angle on a desktop with shadows and light falloff, in normal and dim light. Since the author wrote the text, the OCR could be scored against known answers. The author included a digital report with a large photo, a signed PDF and an encrypted PDF, then looked for failures that would matter on real forms. The first round yielded a sideways photo under the minimum size, a PDF small enough to change numbers, a broken signature, a silently dropped password, a photographed page with incorrect OCR and mean confidence of 86, a two-column page read straight across, and 1.5 GB of leftover page images. One line in a prompt or one check in a report fixed each issue.
The author's 14 sections follow in source order.
- By hand: Why use Grok Bot for conversion. First, it runs real tools on its computer: Pillow for images, pikepdf for PDFs, Tesseract 5.5 for OCR, OpenCV for face and page-edge detection, and poppler PDF tools. It installs what it lacks. When the system package manager could not download anything during the author's run, it finished using Python packages. The tool names are optional knowledge, but they show that standard libraries process the document directly. Second, it can check output. A converter returns a file, while Grok Bot can report exact bytes, pixel dimensions, page count and changed numbers. The report is the author's main reason for using it. Third, prompts can stop on signed PDFs or require approval before going below 100 dpi, which a website cannot do. Attach files in chat. The help page says desktop messages take up to 20 attachments, images up to 25 MB each and documents up to 250 MB each. It also says encrypted or damaged files may be unreadable.
- Bot: Prepare a phone photo for a form. This is the most common upload task and the easiest to get wrong. The first test photo was a normal daylight phone portrait, 1.8 MB and stored as 4032×3024 pixels with a rotation tag, phone model and GPS location twice, in the main EXIF block and a second XMP block. The form wants a JPEG of exactly 200×230 pixels between 20 KB and 50 KB. The prompt:
I've attached a phone photo for an online form. The form wants a JPEG of exactly 200 x 230 pixels, between 20 KB and 50 KB. First turn it upright using the photo's rotation tag. Crop to that shape without stretching, keeping my whole head and the top of my shoulders in frame. Remove all metadata, including location. Aim for 20,480 to 50,000 bytes so it passes whichever way the form counts a KB, and use the highest quality that fits. Then check that the face is upright and the whole head is in frame. Send me the file, a preview, and a short report: pixel size, exact bytes, quality setting, and any metadata left.
The author got an upright, metadata-free 200×230 JPEG of 39,016 bytes at quality 99, with the face filling about half the height. Quality 100 came to 51,578 bytes, just over the limit, so it stopped one step lower. To test each line, the author ran a shortcut that simply resized to 200×230. The image was sideways because rewriting the pixels discarded the phone's rotation tag, which tells viewers how to orient them. It squeezed the face to roughly 65% of its width by fitting 4:3 into 200×230 without cropping. At 14,089 bytes the photo fell below the 20 KB minimum and would be rejected. Keeping metadata retained GPS in both blocks. The same full prompt yielded 37,789 bytes for a dim evening portrait and 47,296 for a landscape shot. Both were upright with the whole head in frame and no metadata. The face detector found faces in the correct orientation in all three full results, covering 47% to 49% of the image height. For two shortcut portrait outputs, the detector found the face most clearly after turning them 90 degrees, confirming they were sideways.
- Bot: Watch the minimum file size and how a KB is counted. The 20 KB floor caught the author twice. A standard quality-95 save of three realistic photos ranged from 13,305 to 15,709 bytes, below 20 KB, because a 200×230 face against a blank wall compresses well. The prompt asks for the highest quality that fits. The first version stepped down in fives: the daylight photo was 51,578 bytes at quality 100 and 18,655 at 95, jumping past the acceptable range and ending at a lower color setting. Going one step at a time found a sharper, in-range result at quality 99 and 39,016 bytes. If quality 100 is still too small, ask whoever runs the form instead of adding junk bytes. Some sites count 1 KB as 1,000 bytes and others as 1,024. Target 20,480 to 50,000 bytes to fit either convention. Many iPhones save HEIC. The author made an 8 MB HEIC version of the dim portrait with location metadata and the same prompt made a 37,754-byte JPEG without the location. The HEIC opened upright already, but shortcut resizing distorted it, so cropping was still important.
- By hand: Check the photo with a one-line command. The author's first check looked only at the main EXIF block and passed a test JPEG with location in XMP only. Here is the revised check with Pillow installed:
python3 -c "from PIL import Image; import os,sys; f=sys.argv[1]; im=Image.open(f); print(im.format, im.size, os.path.getsize(f), 'bytes, extra data:', sorted(k for k in im.info if k in ('exif','xmp','comment','icc_profile')) or 'none')" photo-form.jpg
The output was JPEG, (200, 230), 39016 bytes, and none for extra data. The shortcut output with metadata printed exif and xmp. The XMP-only file printed xmp. If Python is unavailable, paste the command into Grok Bot and have it run on its computer.
- Bot: Compress a scanned PDF below the limit. The test scan was four A4 pages at 300 dpi in color: a small-print notice, a statement of invoice numbers, dates and amounts, a two-column resident notice, and a serif maintenance receipt with a blue PAID stamp. The pages had grain, slight skew and realistic marks, stored as JPEGs the way a scanner app does, for a 4.3 MB PDF with no text layer. The prompt:
Shrink the attached PDF to under 300 KB for an upload form. Work on a copy and never touch the original. Before you start, tell me if it is password-protected or digitally signed, and stop if it is signed. Reduce only the images, keep any real text as text, and keep the page count, order and page sizes. Go down in steps and stop at the first setting under the limit. Don't go below 100 dpi without asking me. If you switch to greyscale and the paper looks grey or textured, clean the background to white, and tell me you did. Then read the numbers on every page of the original and the result, and list any that differ. If the original was locked, lock the result with the same password. Report the setting, the final size and the number check.
The bot tried 200 dpi color (1.07 MB), 150 dpi color (518 KB), then 150 dpi grayscale with a cleaned background (221,792 bytes), which fit. Page count and A4 size stayed the same. The number check flagged just three deliberately difficult small-print codes discussed in section 9. JPEG preserves what people see as harmless paper grain. Without cleaning, 150 dpi grayscale was 346,700 bytes and the next fit was 120 dpi. Cleaning made the 150 dpi version 36% smaller with the same OCR score. The stamp remained visible but lighter, so inspect light stamps and faint pencil marks visually. To find the limit, the author measured the share of words OCR recovered across four pages in any order and the count of 43 planted key numbers, dates and codes read accurately. The results in order: original 300 dpi color, 4.3 MB, 98.2%, 40 of 43. At 200 dpi color, 1.07 MB, 98.8%, 40. At 150 dpi color, 518 KB, 98.4%, 40. At 150 dpi grayscale, 347 KB, 98.4%, 40. At 150 dpi grayscale cleaned, 222 KB, 98.4%, 40. At 100 dpi grayscale cleaned, 110 KB, 97.4%, 40. At 85 dpi grayscale cleaned, 84 KB, 93.3%, 39. At 72 dpi grayscale heavily compressed, 67 KB, 52.8%, 14. Each row missed the same three deliberately ambiguous codes. With a 2 MB cap, Grok Bot stopped at 1.07 MB in full color. At 1 MB it stopped at 518 KB, still color. At 100 KB it stopped at 110 KB and asked before going below 100 dpi. With approval, 85 dpi gave 84 KB and the check caught 112,980.75 becoming 112,980,75. At 50 KB it asked at the same point, as 110 KB was the best result at or above the dpi floor.
- Check: Why the smallest file is a trap. The last result represents aggressive compression and was worse than it looked. At 72 dpi, large numbers still looked readable on the author's screen, but OCR changed receipt MR-55120 to ME-35120 and maintenance amount 36,000.00 to S6,000,00, added a digit to invoice INV-2026-0417 and turned a digit in an account number into a letter. Small text blurred. This matters for machine readers and for people squinting at a phone. The author's first measurement, character error rate, had a flaw: an earlier 150 dpi test scored 21% errors even though all numbers were right, because OCR read a table by columns instead of rows. The author switched to whole words and exact numbers in any order. Real documents have no answer key, so compare OCR readings from the original and output and list mismatches. The author verified this check flagged 29 numbers across four pages of the 72 dpi file, including all four invoice numbers, four amounts, seven dates, receipt number, account number and check number. In the 222 KB file it flagged only the three ambiguous codes. Matching misreads in both files escape detection.
- Bot: Handle digital, signed and locked PDFs. Three other tests went wrong before the author added a line for each.
- Digital PDF: A word processor export contains real text and images. The author's 35.4 MB report had one full-resolution apartment building photo. Rasterizing every page yielded 572 KB, three times larger than needed, and lost the text: a total search returned zero matches, versus 24 in the original. Shrinking only the photo gave 188 KB and kept all 24 matches.
- Signed PDF: The author signed a copy with a test certificate and shrank it. The signature box stayed visible, but pdfsig reported that the document was not signed in full and the signature's byte range was invalid. A stricter validator said the signature was incomplete, and anyone checking would see it had been modified. With the revised prompt, Grok Bot checked first and stopped on a signed-file rerun. Check a PDF with poppler's pdfsig:
pdfsig report-signed.pdf
On the untouched signed file, it printed that the full document was signed and the signature valid. The issuer was unknown because the certificate was for testing. On Grok Bot's computer a security database warning appeared first, and the check still ran.
- Locked PDF: Every tool correctly refused without the password. A merge tool misleadingly called the locked file corrupt, so check for a password if you see that. With a password, the first run silently produced a smaller file without any password. Requiring the same password on the result fixed it. The rerun returned a locked 223 KB file with the number check complete.
The author checked what came back for every compressed PDF:
pdfinfo scan-small.pdf | grep -E "Pages|Page size|File size|Encrypted"
The output showed 4 pages, unencrypted, 595.276×841.89 points (A4) and 221792 bytes.
- Bot: Make the scan searchable. A searchable PDF still looks like the scan, but text is searchable and copyable and a number can be found months later. The prompt:
Make the attached scan searchable. OCR it in English. If a page is a photo of a sheet on a desk, find the page edges and flatten it first. Detect and fix sideways or tilted pages, and handle shadows and uneven lighting. If a page has two columns, read each column in order instead of straight across. Keep the page images and add an invisible text layer, so it still looks like the scan. For each page report the word count and average confidence, and flag any page with fewer than 20 words or confidence under 70 for me to check by hand. Then search the result for 142,796.25 and 41,050.00 to prove it works.
The 4.3 MB scan became a 521 KB searchable PDF in about a minute and a half. Both searches matched, no pages were flagged, mean confidence was 92 to 95 per page, and it recovered 95% to 100% of the words across four pages and 40 of 43 key items, missing only the ambiguous codes. The first prompt had no column rule, so the two-column notice was read straight across, joining each left-column line to the right-column line. Every word was present and the word count showed 100%, but copied text was gibberish and a search for a full sentence about water shutoff from 10:00 to 14:00 on Sunday found nothing. With the column rule, Grok Bot found the gap, read left then right and wrote the text layer in that order, so the full sentence matched. Some PDF tools reconstruct text by position, which can still mix columns. Inspect the order in which text was written with this command:
pdftotext -raw -f 3 -l 3 scan-searchable.pdf - | head -4
The output was the left column in order: heading, shutoff time and the advice to store water. With no -raw flag, positional sorting inserted a right-column sentence about guest parking moving to spaces 30 to 38 into the middle of the shutoff sentence. The author did not test how individual PDF readers behave.
- Check: Photographed pages, sideways pages and misleading confidence. Flatbed scans are the easy case, so the author tested two other common inputs. Sideways page: A page entered the scanner in the wrong orientation. Without rotation detection it scored 0%, was flagged and had mean confidence 29. With it, the page turned upright automatically and scored 98.3%. Photo of paper on a desk: The statement was angled, with a hand shadow and light getting dimmer away from a window. Raw OCR recovered 84.5% to 89.7% of words depending on settings. With shadow-sensitive settings, all four invoice numbers became INV-2026-043. Mean confidence of 89 or 90 raised no flags. The dim version was worse: default settings read 79.3% of words, got 5 of 18 statement numbers wrong and reported mean confidence of 86. A simple success question would have passed a faulty page. The instruction to find the edges and flatten the sheet fixed it. Both photos returned to 98.3% of words and 17 of 18 statement numbers, matching the flatbed scan, with mean confidence 91 to 92. Flattening needs shadow correction too: flattening alone at default settings worsened scores to 55% to 62% because shadows and light falloff remained. The first edge detector included the edge of a laptop and cut off a shadowed paper corner. Finding paper by lack of color and ignoring anything touching the photo border fixed both. The page flag cannot catch all misses. At 85 dpi grayscale, OCR changed customer ID KLM4471Q to KLM44710 while the page report looked fine. Flags catch empty or very uncertain pages but miss a single wrong letter or digit in an ID. All tested settings struggled to distinguish 0 from O and 1 from l and I in deliberately planted codes such as QX7-0O8-1lI5. Real reference, account and ID numbers often look like this. Use OCR to find things and check any ID, account or amount intended for a form or payment visually against the original.
- Bot: Merge, split and reorder. This is the easiest job and also the easiest to get wrong without noticing. The prompt:
Combine these three PDFs into one, in this order: the cover letter, the scan, the chart. Keep every page's original size and orientation. Then tell me the page count, each page's size and the first line of text on each page, so I can check the order without opening it.
It returned six pages: one U.S. Letter cover letter, four A4 scan pages and one landscape chart, with sizes unchanged. First lines identified, in order, the cover letter, office hours change notice, expense statement, resident notice, annual maintenance receipt and chart. The original scans had no text, so the first lines were empty until the author switched to the searchable version from section 8. These are the poppler commands the author ran:
pdfunite cover-letter.pdf scan-searchable.pdf chart-landscape.pdf merged.pdf pdfinfo merged.pdf | grep -E "Pages|Encrypted" pdfseparate -f 3 -l 3 merged.pdf page-%d.pdf
The first merges the files, the second confirms six pages and the third extracts page 3.
- Bot: Clean up after the job. This was the most unexpected flaw. The prompt:
This job is done. Delete the originals and every copy you made, including temporary page images, then show me a listing that proves they're gone.
The first cleanup left the task folder empty and the author nearly stopped there. A check of temporary storage found over 200 temporary directories full of page images, totaling about 1.5 GB. Each OCR or compression step first renders pages into images, which are document copies. The author removed them, had Grok Bot change its scripts to remove temporary page images automatically, and reran the job. Nothing remained. That is why the prompt includes temporary page images. A second round found another copy: the compression script had used a fixed temporary filename for an unlocked working copy. Two concurrent locked jobs overwrote each other's files, one failed and the failed run left an unlocked copy of an encrypted document. Now each job uses a private temporary directory that is always removed and retains only the finished, relocked file. Both concurrent locked jobs then completed and relocked with no unlocked copies left. The help page says bots share a cloud computer and can see files other bots save. Grok Bot maintains a persistent copy of synced files, so deleted files usually reappear after a restore. The author did not test this and treats deletion as cleanup without a guarantee of erasure. For truly sensitive files, strip anything the form does not need before attaching.
- By hand: Understand the cost. Grok Bot is included in X's $30/month Premium plan, $100/month Super and $200/month Ultra. The $8 Plus plan and free tier exclude it. Tasks draw from one weekly pool shared with Grok and Cursor. Prices exclude tax. All tools used were free and open source, with no extra per-file fee. OCR took most of the time. On an 8-core CPU cloud computer with no GPU, each photo took about a second, making four pages searchable took about a minute and a half, and 300 KB compression with number checks about a minute and a half.
- Check: Confirmed and unconfirmed. The author's runs confirmed upright, centered, metadata-free form photos made from three realistic phone photos, at 37,789 to 47,296 bytes and quality 99 or 100. Simple resizing made sideways, squeezed photos below the 20 KB floor, and keeping metadata retained GPS in both EXIF and XMP. Steps of five skipped the 20 to 50 KB range and steps of one landed in it. The one-line Python check detected EXIF and XMP. A textured 4.3 MB scan compressed to 222 KB at 150 dpi with the paper background cleaned and no change to page count or dimensions. At 150 dpi without cleanup, grayscale was 347 KB. At heavily compressed 72 dpi, OCR changed a receipt number, an amount, an invoice number and an account number. Comparing the original with the result flagged 29 numbers on the damaged file, one changed amount at 85 dpi and only the ambiguous codes on the good file. Rasterizing a digital PDF removed searchable text and shrinking only images preserved it. Compression broke a digital signature, and the prompt's check stopped a run on a signed file. Locked output came back unlocked until the prompt required relocking. OCR recovered 95% to 100% of words on four scan pages and kept two-column reading order only when requested. Rotation detection rescued a sideways page. Flattening with shadow processing rescued desk photos in normal and dim light. A photo with 5 of 18 numbers wrong showed mean confidence 86. Temporary page images and an unlocked working copy remained accessible to other jobs until the fixes. Unconfirmed or untested: real, non-generated files. The author used fictional image-generated people upscaled to phone dimensions and self-written scans with simulated paper, light and camera effects. Handwriting, colored forms and crumpled pages were untested, as were checks of dimensions, DPI or face position at any specific government or exam portal, other languages, ruled tables, pages of three or more columns, individual readers' text ordering for copying and search, other OCR engines and larger, slower Tesseract models, whether deleted files return on restore as the help page describes, files over attachment limits and very long PDFs.
- By hand: The bigger picture and a checklist to save. The author says most form friction is in the files: wrong dimensions or shape, too big to upload or impossible to search later. For years the default was to try a random website. A real computer lets Grok Bot change that when used as a careful assistant. The tools followed instructions. Test failures came from missing instructions about rotation tags, flattening photos, cleaning paper, keeping at least 100 dpi, retaining passwords, comparing numbers or deleting page images. Most prompts in the guide add those instructions. The author asks what readers would use for their next upload: a free converter, Grok Bot with these prompts, a desktop app or command-line tools on their own laptop. The author's 18-item checklist follows in Key points and results.
Check: Each prompt includes a check. The photo report supplies exact pixels, bytes, quality and remaining metadata, followed by a one-line EXIF and XMP check. The PDF report includes settings, final size and a page-by-page comparison of numbers in the original and result, followed by pdfinfo to check page count, dimensions and encryption. Check for signatures before processing and stop if signed. For OCR, check word counts and confidence without relying on confidence alone. For merging, verify page count, sizes and first lines. Afterward request a directory listing to show copies were removed. Section 13 gives separate confirmed and unconfirmed lists. All figures come from the author's test files and were not reproduced by Bot in Practice.
Key points and results
- A minimum can be as tricky as a maximum. A 200×230 photo at quality 95 can be just 13,305 to 15,709 bytes, below the 20 KB floor. Stepping down by fives can skip the 20 to 50 KB range. One-step changes found quality 99 at 39,016 bytes. If quality 100 is too small, ask the form provider and avoid padding with junk.
- A KB has two common definitions. Some sites use 1,000 bytes and others 1,024. A range of 20,480 to 50,000 bytes fits both.
- An EXIF-only check misses other metadata. The first check passed a test image with location in XMP only. The author's one-line Python check now covers exif, xmp, comment and icc_profile.
- Dropping the rotation tag before resizing leaves a sideways photo everywhere. Apply the tag before cropping. Forcing 4:3 into the target without cropping squeezes the face to about 65% of its width.
- Average OCR confidence can mislead. A dim desk photo reported mean confidence 86 while misreading 5 of 18 statement numbers and recovering 79.3% of words. At 85 dpi, customer ID KLM4471Q became KLM44710 with a normal report. Compare numbers to the original instead of asking only whether it worked.
- OCR struggles with 0 and O and with 1, l and I. None of the tested settings distinguished them reliably. Verify any ID, account or amount for a form or payment visually against the original. Use OCR for finding text.
- The smallest file is a trap. At heavily compressed 72 dpi, OCR gave ME-35120 for receipt MR-55120 and S6,000,00 for 36,000.00, and added a digit to invoice INV-2026-0417. Step down gradually and ask before going below 100 dpi.
- Paper grain affects compression. Without cleaning, 150 dpi grayscale is 346,700 bytes and requires dropping to 120 dpi to fit. Cleaning it at 150 dpi cut size by 36% with the same OCR score. Check faint pencil marks and light stamps visually.
- Shrink only the images in a digital PDF. Rasterizing every page produced 572 KB and lost text: zero matches for the total versus 24 in the original. Shrinking only the image yielded 188 KB and all 24 matches.
- Compression breaks digital signatures, so stop on signed files. The box may remain while verification shows the document was changed. Relock password-protected results with the same password to avoid silently returning a smaller unlocked file.
- Specify column-by-column reading for two-column pages. Without it, word recovery was 100% but full sentences did not match. Reading left then right made the search work. Some PDF tools still reconstruct text by position. The author did not test individual readers.
- Flatten photographed pages and handle shadows before OCR. Flattening alone made results worse at 55% to 62%. Together they yielded 98.3% of words and 17 of 18 numbers on both shots. A sideways page scored 0% without rotation detection and 98.3% with it.
- Clean up temporary page images too. The test left over 200 temporary folders, about 1.5 GB of document page images. A fixed temporary filename let concurrent locked-PDF jobs overwrite an unlocked working copy. After the fix, each task had a private temporary directory. Deletion does not guarantee erasure because the bots share a cloud computer, synced files have persistent copies and deleted files usually return after restore (untested by the author). Before attaching sensitive files, remove content the form does not need.
- The figures come from the author's test files and were not reproduced by Bot in Practice. The people were generated fictional subjects and the scans used the author's printed text and simulated effects. Handwriting, colored forms, crumpled pages, other languages, pages with three or more columns and specific portal rules were untested.
- The author's checklist (18 items):
- Specify exact photo pixels, file type and both size limits.
- Apply the rotation tag before cropping.
- Crop to shape without stretching.
- Remove all metadata and check EXIF and XMP.
- For a 20 to 50 KB form, aim for 20,480 to 50,000 bytes.
- Request the highest quality that fits to meet the minimum too.
- Verify that the face is upright and the whole head is in frame.
- Shrink only PDF images and keep real text as text.
- Clean gray or textured paper to white before compression, then check stamps and faint marks.
- Set a 100 dpi floor and have the bot ask before going below it.
- Compare the numbers in the original and result.
- Stop on signed PDFs and keep the original signed copy.
- Relock password-protected results with the same password.
- Identify multi-column pages and check the copied text order.
- Flatten page photos before OCR, and fix sideways or tilted pages.
- Flag pages with very few words and look beyond confidence scores.
- Check every ID, account number and amount visually.
- When done, remove originals, outputs and temporary page images.
Source
- Platform
- X
- Author
- Varun Chopra
- Published
- Categories
- Life assistant
What this evidence label means
Author's claim, unverified
The method and results come from the author's own account. This site has not reproduced them.