Filemate: Your Command-Line File Conversion and Manipulation Tool
Filemate is a versatile command-line tool designed to streamline your file conversion and manipulation tasks. It currently focuses on image and PDF files, offering efficient ways to convert, manipulate, and extract information from them.
Features
- Image Conversion: Convert images between various formats like JPEG, PNG, WebP, GIF, and TIFF.
- PDF Conversion: Convert images to PDFs, PDFs to images, and merge multiple PDF files.
- Image Manipulation: Resize, rotate, and grayscale images.
- File Information: Get detailed information about files (type, size, dimensions for images, page count for PDFs).
Installation
-
Install
pipx(if you don't have it):python -m pip install --user pipx python -m pipx ensurepath
This ensures that
pipxis installed globally and its executables are present in your system's PATH. You may need to restart your terminal for these changes to take effect. -
Install
file-mateusingpipx:pipx install file-mate
This command installs
file-mateinto an isolated environment and makes thefile-matecommand accessible from anywhere.
Usage
The file-mate tool provides the following commands:
-
convert: For file format conversion.-
file-mate convert image <input_file> <output_file> [--format <target_format>] [--quality <0-100>]: Converts a single image file.input_file: Path to the input image file.output_file: Path to the output image file.--format: (Optional) Target image format (e.g.,png,jpg,webp). If omitted, the extension of the output file will be used.--quality: (Optional) Image quality (0-100) for lossy formats like JPEG and WebP. Default is 100.
Example:
file-mate convert image input.png output.jpg --quality 90
-
file-mate convert image-batch <input_dir> <output_dir> [--format <target_format>] [--quality <0-100>] [--recursive]: Converts a batch of images in a directoryinput_dir: Path to the input directory.output_dir: Path to the output directory.--format: (Optional) Target image format (e.g.,png,jpg,webp). If omitted, the extension of the output file will be used.--quality: (Optional) Image quality (0-100) for lossy formats like JPEG and WebP. Default is 100.--recursive: (Optional) Process subdirectories recursively.
Example:
file-mate convert image-batch input_dir output_dir --format jpg --recursive
-
file-mate convert image-to-pdf <input_image> <output_pdf>: Converts an image to a PDF file.input_image: Path to the input image file.output_pdf: Path to the output PDF file. Example:
file-mate convert image-to-pdf input.png output.pdf
-
file-mate convert pdf-to-images <input_pdf> <output_dir> [--format <target_format>]: Converts a PDF file to a series of images.input_pdf: Path to the input PDF file.output_dir: Path to the directory where the output images will be saved.--format: (Optional) Target image format for the extracted images (default ispng). Example:
file-mate convert pdf-to-images input.pdf output_dir --format jpg
-
file-mate convert merge-pdf <pdf1> <pdf2> ... <output_pdf>: Merges multiple PDF files into one.pdf1,pdf2, ...: Paths to the input PDF files.output_pdf: Path to the output merged PDF file. Example:
file-mate convert merge-pdf file1.pdf file2.pdf output.pdf
-
-
manip: For image manipulation.-
file-mate manip resize <input_image> <output_image> [--width <pixels>] [--height <pixels>] [--scale <0-1>]: Resizes an image file.input_image: Path to the input image file.output_image: Path to the output image file.--width: (Optional) Target width in pixels.--height: (Optional) Target height in pixels.--scale: (Optional) Scale factor for resizing (0-1).
Example:
file-mate manip resize input.png output.png --width 200 --height 100 file-mate manip resize input.png output.png --scale 0.5
-
file-mate manip rotate <input_image> <output_image> [--degrees <90/180/270>]: Rotates an image file.input_image: Path to the input image file.output_image: Path to the output image file.--degrees: Rotation degree (90, 180 or 270). Example:
file-mate manip rotate input.png output.png --degrees 90
-
file-mate manip grayscale <input_image> <output_image>: Converts an image to grayscale.input_image: Path to the input image file.output_image: Path to the output image file. Example:
file-mate manip grayscale input.png output.png
-
-
info: For extracting file information.file-mate info <file_path>: Displays information about a file.file_path: Path to the file. Example:
file-mate info input.pdf file-mate info input.png
Configuration
file-mate has no external configuration currently.
Development and Testing
- Editable Install: To avoid re-installing the package again and again during local development, you should run the tool inside your virtual environment. For this you have to activate your environment and then run
pip install -e .from the root directory. Now you can use the tool with the activated virtual environment. Whenever you want to update the global version then you have to uninstall the current version usingpipx uninstall file-mateand install again usingpipx install file-mate. - Running Tests:
- The tests are located in the
file_mate/testsdirectory. You can run the tests usingpytestfrom the root of your project i.e. wheresetup.pyexists.pytest -v -s file_mate/tests
- The tests are located in the
Dependencies
Pillowpypdfpython-magic-binclickreportlabsetuptools
License
This project is licensed under the MIT License.
Metadata
Release files for file-mate 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| file_mate-0.1.1.tar.gz | 11.4 kB | With provenance | Details for file_mate-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| file_mate-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for file_mate-0.1.1-py3-none-any.whl |
Total release size: 24.4 kB
Release files / file_mate-0.1.1.tar.gz
| Download URL | file_mate-0.1.1.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8d8700da9731c4613cf6dc1b510be9f1e974e06e7dbe118cf9b0e6edd9fee1a
|
|
BLAKE2b-256 checksum How to use checksums |
c3cc47644c76133713f63cabe3a2ba68b2ef9805fde45d438e3dac09879b5805
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 12, 2025.
Transparency logRelease files / file_mate-0.1.1-py3-none-any.whl
| Download URL | file_mate-0.1.1-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8f9555e30cf0acb0c045cebd592a4c4359be0e94fe3d87a13e9a4e2af663ae5c
|
|
BLAKE2b-256 checksum How to use checksums |
3c985b34e47394b2772be70c80b8d07c2ae2a0163e9c4c40a2b0a003a7cc1ada
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 12, 2025.
Transparency logSecurity for file-mate 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for file_mate-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 12, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.