79810103

Date: 2025-11-05 13:24:53
Score: 1
Natty:
Report link

@KJ

jpeg for demonstration

pdf file with said jpeg

excuse me, I meant jpeg.

  1. Thanks! I’ve added a minimal sample PDF + the source PNG here: (link).
    I’m not relying on viewer defaults—I compute the page size as points = pixels * 72 / targetDPI and draw the CGImage 1:1 (no interpolation). Despite that, thin glyphs show “holes” at typical zoom in Preview/PDFKit.
    Do you know if iOS/macOS forces a particular image filter (e.g., JPEG re-encode) or disables smoothing for 1-bit/grayscale images inside PDFs? Any flag to guarantee lossless Flate (8-bit) or CCITT G4 (1-bit)?

  2. Agree that PDF has no intrinsic DPI—only user space. That’s why I scale the page so one image pixel maps cleanly at a chosen effective DPI. The issue persists even with 8-bit grayscale (not just 1-bit).
    Are there known viewer behaviors in Preview/PDFKit that render bilevel/high-contrast rasters without anti-aliasing? If so, would your recommendation be to (a) embed as 8-bit grayscale at 2× resolution, or (b) pre-apply a tiny morphological close/blur to avoid “holes”? Any other reliable workaround?

I hope it's useful

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Kitty Cat