imageconvert


Nameimageconvert JSON
Version 0.3.1 PyPI version JSON
download
home_pageNone
SummaryA Python library for converting between different image formats with metadata preservation
upload_time2025-08-02 18:45:58
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords image conversion metadata exif photos avif heif heic webp jfif pdf
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # πŸ–ΌοΈ ImageConvert

[![PyPI version](https://img.shields.io/pypi/v/imageconvert.svg)](https://pypi.org/project/imageconvert/)
[![Python version](https://img.shields.io/pypi/pyversions/imageconvert.svg)](https://pypi.org/project/imageconvert/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
[![Docs](https://img.shields.io/badge/documentation-blue)](https://ricardos-projects.gitbook.io/imageconvert-docs)

**ImageConvert** is a Python library for converting images (and PDFs) between different formats, while preserving metadata (EXIF) and timestamps.

## πŸš€ Key Features

- **Format Support:** Convert between JPEG, PNG, TIFF, WebP, BMP, SVG, RAW, HEIC/HEIF, AVIF, and PDF
- **PDF Conversion:**
  - **PDF β†’ Images:** Extract pages from a PDF as high‑resolution images
  - **Images β†’ PDF:** Assemble multiple images into a single PDF document
- **Metadata Preservation:** Keep EXIF data and other metadata intact
- **Timestamp Preservation:** Maintain file creation and modification times
- **Batch Processing:** Convert entire directories with optional recursion
- **Image Info Extraction:** Get detailed image metadata including GPS and camera details

## πŸ“‹ Quick Usage Examples

### Simple Image Conversion
```python
from imageconvert import ImageConvert

# Convert from JPG to PNG (preserves metadata by default)
ImageConvert.convert("photo.jpg", "photo.png")

# Convert from any format to AVIF with quality control
ImageConvert.convert("image.png", "image.avif", quality=80)
```

### PDF β†’ Images
```python
# Convert each page of a PDF to separate JPEG files
pages = ImageConvert.pdf_to_images(
    pdf_path="document.pdf",
    output_dir="output_images",
    format=".jpg",
    quality=90,
    dpi=300
)
print(f"Extracted pages: {pages}")
```

### Images β†’ PDF
```python
# Combine PNG images into a single PDF
output_pdf = ImageConvert.images_to_pdf(
    image_paths=["page1.png", "page2.png", "page3.png"],
    output_pdf="combined.pdf",
    page_size="A4",
    fit_method="contain",
    quality=85,
    metadata={"title": "My Album", "author": "Ricardo"}
)
print(f"Created PDF: {output_pdf}")
```

### Batch Conversion
```python
# Convert all supported images in a directory to WebP
converted = ImageConvert.batch_convert(
    input_dir="photos",
    output_dir="converted",
    output_format=".webp",
    recursive=True
)
print(f"Files converted: {len(converted)}")
```

### Get Image or PDF Info
```python
# For images
info = ImageConvert.get_image_info("photo.jpg")
print(f"Dimensions: {info['width']}x{info['height']}")
# For PDFs
pdf_info = ImageConvert.get_image_info("document.pdf")
print(f"Pages: {pdf_info['page_count']}, Size: {pdf_info['width']}x{pdf_info['height']}")
```

## πŸ“¦ Installation

```bash
pip install imageconvert
```

βœ… **Requires Python 3.7+**

> **Note:**
> - AVIF, HEIC, and HEIF read/write support requires `pillow-heif` (installed automatically with `imageconvert`)

## 🩰 Supported Formats

| Format | Extensions        | Read | Write | Notes                                        |
|--------|-------------------|------|-------|----------------------------------------------|
| JPEG   | `.jpg`, `.jpeg`   | βœ“    | βœ“     | Full metadata preservation                   |
| PNG    | `.png`            | βœ“    | βœ“     | Lossless compression                         |
| TIFF   | `.tiff`, `.tif`   | βœ“    | βœ“     | Full metadata preservation                   |
| WebP   | `.webp`           | βœ“    | βœ“     | Modern web format                            |
| BMP    | `.bmp`            | βœ“    | βœ“     | Basic bitmap format                          |
| HEIF   | `.heif`, `.heic`  | βœ“    | βœ“     | Requires `pillow-heif`                       |
| AVIF   | `.avif`           | βœ“    | βœ“     | Requires `pillow-heif`                       |
| RAW    | `.raw`            | βœ“    | βœ—     | Camera raw format (read only)                |
| SVG    | `.svg`            | βœ“    | βœ—     | Vector format (read only)                    |
| PDF    | `.pdf`            | βœ“    | βœ“     | PDFβ†’Images & Imagesβ†’PDF conversion           |

## πŸ“ƒ Full Documentation

Explore the complete documentation and examples here:  
πŸ‘‰ [https://ricardos-projects.gitbook.io/imageconvert-docs](https://ricardos-projects.gitbook.io/imageconvert-docs)

## πŸ“„ License

This project is licensed under the MIT License.  
See the [LICENSE](https://github.com/mricardo888/ImageConvert/blob/main/LICENSE) file for details.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "imageconvert",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "mricardo <ricardo.lee.cm@gmail.com>",
    "keywords": "image, conversion, metadata, exif, photos, avif, heif, heic, webp, jfif, pdf",
    "author": null,
    "author_email": "mricardo <ricardo.lee.cm@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/9d/69/6e2c8a6dc24816af1b07e47b9d7982b6076e9fc554841c18f6d3cf6a886a/imageconvert-0.3.1.tar.gz",
    "platform": null,
    "description": "# \ud83d\uddbc\ufe0f ImageConvert\n\n[![PyPI version](https://img.shields.io/pypi/v/imageconvert.svg)](https://pypi.org/project/imageconvert/)\n[![Python version](https://img.shields.io/pypi/pyversions/imageconvert.svg)](https://pypi.org/project/imageconvert/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)\n[![Docs](https://img.shields.io/badge/documentation-blue)](https://ricardos-projects.gitbook.io/imageconvert-docs)\n\n**ImageConvert** is a Python library for converting images (and PDFs) between different formats, while preserving metadata (EXIF) and timestamps.\n\n## \ud83d\ude80 Key Features\n\n- **Format Support:** Convert between JPEG, PNG, TIFF, WebP, BMP, SVG, RAW, HEIC/HEIF, AVIF, and PDF\n- **PDF Conversion:**\n  - **PDF \u2192 Images:** Extract pages from a PDF as high\u2011resolution images\n  - **Images \u2192 PDF:** Assemble multiple images into a single PDF document\n- **Metadata Preservation:** Keep EXIF data and other metadata intact\n- **Timestamp Preservation:** Maintain file creation and modification times\n- **Batch Processing:** Convert entire directories with optional recursion\n- **Image Info Extraction:** Get detailed image metadata including GPS and camera details\n\n## \ud83d\udccb Quick Usage Examples\n\n### Simple Image Conversion\n```python\nfrom imageconvert import ImageConvert\n\n# Convert from JPG to PNG (preserves metadata by default)\nImageConvert.convert(\"photo.jpg\", \"photo.png\")\n\n# Convert from any format to AVIF with quality control\nImageConvert.convert(\"image.png\", \"image.avif\", quality=80)\n```\n\n### PDF \u2192 Images\n```python\n# Convert each page of a PDF to separate JPEG files\npages = ImageConvert.pdf_to_images(\n    pdf_path=\"document.pdf\",\n    output_dir=\"output_images\",\n    format=\".jpg\",\n    quality=90,\n    dpi=300\n)\nprint(f\"Extracted pages: {pages}\")\n```\n\n### Images \u2192 PDF\n```python\n# Combine PNG images into a single PDF\noutput_pdf = ImageConvert.images_to_pdf(\n    image_paths=[\"page1.png\", \"page2.png\", \"page3.png\"],\n    output_pdf=\"combined.pdf\",\n    page_size=\"A4\",\n    fit_method=\"contain\",\n    quality=85,\n    metadata={\"title\": \"My Album\", \"author\": \"Ricardo\"}\n)\nprint(f\"Created PDF: {output_pdf}\")\n```\n\n### Batch Conversion\n```python\n# Convert all supported images in a directory to WebP\nconverted = ImageConvert.batch_convert(\n    input_dir=\"photos\",\n    output_dir=\"converted\",\n    output_format=\".webp\",\n    recursive=True\n)\nprint(f\"Files converted: {len(converted)}\")\n```\n\n### Get Image or PDF Info\n```python\n# For images\ninfo = ImageConvert.get_image_info(\"photo.jpg\")\nprint(f\"Dimensions: {info['width']}x{info['height']}\")\n# For PDFs\npdf_info = ImageConvert.get_image_info(\"document.pdf\")\nprint(f\"Pages: {pdf_info['page_count']}, Size: {pdf_info['width']}x{pdf_info['height']}\")\n```\n\n## \ud83d\udce6 Installation\n\n```bash\npip install imageconvert\n```\n\n\u2705 **Requires Python 3.7+**\n\n> **Note:**\n> - AVIF, HEIC, and HEIF read/write support requires `pillow-heif` (installed automatically with `imageconvert`)\n\n## \ud83e\ude70 Supported Formats\n\n| Format | Extensions        | Read | Write | Notes                                        |\n|--------|-------------------|------|-------|----------------------------------------------|\n| JPEG   | `.jpg`, `.jpeg`   | \u2713    | \u2713     | Full metadata preservation                   |\n| PNG    | `.png`            | \u2713    | \u2713     | Lossless compression                         |\n| TIFF   | `.tiff`, `.tif`   | \u2713    | \u2713     | Full metadata preservation                   |\n| WebP   | `.webp`           | \u2713    | \u2713     | Modern web format                            |\n| BMP    | `.bmp`            | \u2713    | \u2713     | Basic bitmap format                          |\n| HEIF   | `.heif`, `.heic`  | \u2713    | \u2713     | Requires `pillow-heif`                       |\n| AVIF   | `.avif`           | \u2713    | \u2713     | Requires `pillow-heif`                       |\n| RAW    | `.raw`            | \u2713    | \u2717     | Camera raw format (read only)                |\n| SVG    | `.svg`            | \u2713    | \u2717     | Vector format (read only)                    |\n| PDF    | `.pdf`            | \u2713    | \u2713     | PDF\u2192Images & Images\u2192PDF conversion           |\n\n## \ud83d\udcc3 Full Documentation\n\nExplore the complete documentation and examples here:  \n\ud83d\udc49 [https://ricardos-projects.gitbook.io/imageconvert-docs](https://ricardos-projects.gitbook.io/imageconvert-docs)\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License.  \nSee the [LICENSE](https://github.com/mricardo888/ImageConvert/blob/main/LICENSE) file for details.\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python library for converting between different image formats with metadata preservation",
    "version": "0.3.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/mricardo888/ImageConvert/issues",
        "Documentation": "https://ricardos-projects.gitbook.io/imageconvert-docs",
        "GitHub Docs": "https://github.com/mricardo888/ImageConvert#readme",
        "Homepage": "https://github.com/mricardo888/ImageConvert"
    },
    "split_keywords": [
        "image",
        " conversion",
        " metadata",
        " exif",
        " photos",
        " avif",
        " heif",
        " heic",
        " webp",
        " jfif",
        " pdf"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "06807b6700b0fb9d9049acdceb0ca952ffdb463342363f06da573168f277e237",
                "md5": "c4e83d1d31bc2a598b76f728397b137e",
                "sha256": "4564d10d935acba02588c466b92219ddfccd4d98b56ba9aa72c81ca4be24407f"
            },
            "downloads": -1,
            "filename": "imageconvert-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c4e83d1d31bc2a598b76f728397b137e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 14007,
            "upload_time": "2025-08-02T18:45:57",
            "upload_time_iso_8601": "2025-08-02T18:45:57.401061Z",
            "url": "https://files.pythonhosted.org/packages/06/80/7b6700b0fb9d9049acdceb0ca952ffdb463342363f06da573168f277e237/imageconvert-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9d696e2c8a6dc24816af1b07e47b9d7982b6076e9fc554841c18f6d3cf6a886a",
                "md5": "5ece8dcb3c84f969569d4267c3e86f95",
                "sha256": "54c7eb93bde4617f90e8a8f14762dacf31e4ee91abc21f726918c5b0a1b18f18"
            },
            "downloads": -1,
            "filename": "imageconvert-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "5ece8dcb3c84f969569d4267c3e86f95",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 15412,
            "upload_time": "2025-08-02T18:45:58",
            "upload_time_iso_8601": "2025-08-02T18:45:58.284691Z",
            "url": "https://files.pythonhosted.org/packages/9d/69/6e2c8a6dc24816af1b07e47b9d7982b6076e9fc554841c18f6d3cf6a886a/imageconvert-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-02 18:45:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mricardo888",
    "github_project": "ImageConvert",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "imageconvert"
}
        
Elapsed time: 0.69488s