--- id: img2pdf version: "0.6.3" license: unclear license_treatment: copyleft maintenance: aging --- # img2pdf — Lossless conversion of raster images to PDF. License: copyleft · Maintenance: aging · Downloads: 2.3M/mo ## What it is and what it does img2pdf is a Python library and command-line tool that converts raster images into PDF files while preserving image quality and minimizing file size. Unlike general-purpose image converters, it avoids re-encoding pixel data whenever possible—for JPEG, JPEG2000, PNG, TIFF, and JBIG2 formats, the image data is embedded directly into the PDF container with only minimal PDF overhead added. For other formats or color spaces, it applies appropriate compression filters (PNG Paeth, CCITT Group 4, or flate) before embedding. The package works both as a standalone command-line tool and as a Python library. It handles single images, multiple images, and batch operations from directories or glob patterns. It depends on Pillow for image metadata extraction and format conversion when needed, and pikepdf for PDF handling. The tool is designed to handle large images efficiently by avoiding full decompression into memory during the conversion process. Use it for: - Batch convert a folder of photographs to PDF without quality loss or file bloat for archival or sharing. - Create a multi-page PDF from a sequence of scanned document images while preserving original resolution. - Embed images directly into PDF containers from a Python script with minimal overhead and maximum speed. - Process JPEG or PNG images to PDF in a pipeline (e.g., from a scanner or camera) without intermediate re-encoding. - Handle CMYK or monochrome images that require specific PDF encoding while keeping file sizes small. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Converts raster images to PDF without re-encoding pixel data, prioritizing lossless output, small file size, and speed by embedding images directly into the PDF container when possible. Yes. The package fills a specific, well-defined niche: lossless image-to-PDF conversion with minimal file size and fast processing. Low install friction, no security vulnerabilities, and broad format support make it a solid choice for image-to-PDF workflows. The copyleft license is a minor consideration only if you plan to redistribute derivative code. Aging maintenance status (282 days since last release) is not a blocker for a stable, mature tool, but monitor for any future issues. ## Install pip install img2pdf uv add img2pdf poetry add img2pdf ## Installing img2pdf Before you install: Low friction install with two stable runtime dependencies (Pillow and pikepdf). Package shows aging maintenance status with last release 282 days ago, but has been actively maintained since 2014 and supports current Python versions. License in practice: Licensed under LGPLv3 (copyleft). You may use and modify the package freely, but any derivative works must also be licensed under LGPLv3 and source code must be made available. Quickstart: pip install img2pdf import img2pdf with open("output.pdf", "wb") as f: f.write(img2pdf.convert('input.jpg')) Input images must be provided as files or file handles; img2pdf needs to seek in the file descriptor and cannot work from pure in-memory byte streams alone. Verify before relying: - Whether pikepdf is always required or only for certain image formats or operations - Performance characteristics on very large images relative to other tools - Compatibility with all PDF readers for directly-embedded formats beyond Adobe Acrobat Reader ## Package facts - License: not declared (copyleft) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 2.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags image to pdf conversion, lossless image pdf, batch convert images pdf, raster to pdf, fast image pdf without reencoding, command line image pdf tool, python image pdf library, image-conversion, pdf-generation, cli-tool [View on SkillFed](https://skillfed.io/packages/img2pdf) · [View on PyPI](https://pypi.org/project/img2pdf/)