A command-line tool for image, pdf, and other file manipulations.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file file_mate-0.1.1.tar.gz.
File metadata
- Download URL: file_mate-0.1.1.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8d8700da9731c4613cf6dc1b510be9f1e974e06e7dbe118cf9b0e6edd9fee1a
|
|
| MD5 |
7e707fd1bebd960b7b169a06a878f424
|
|
| BLAKE2b-256 |
c3cc47644c76133713f63cabe3a2ba68b2ef9805fde45d438e3dac09879b5805
|
Provenance
The following attestation bundles were made for file_mate-0.1.1.tar.gz:
Publisher:
pypi-publish.yml on Anshulgada/file-mate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
file_mate-0.1.1.tar.gz -
Subject digest:
a8d8700da9731c4613cf6dc1b510be9f1e974e06e7dbe118cf9b0e6edd9fee1a - Sigstore transparency entry: 161862355
- Sigstore integration time:
-
Permalink:
Anshulgada/file-mate@1340cda3157bdbc7a61e783d69878d0af92b9d66 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Anshulgada
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@1340cda3157bdbc7a61e783d69878d0af92b9d66 -
Trigger Event:
push
-
Statement type:
File details
Details for the file file_mate-0.1.1-py3-none-any.whl.
File metadata
- Download URL: file_mate-0.1.1-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f9555e30cf0acb0c045cebd592a4c4359be0e94fe3d87a13e9a4e2af663ae5c
|
|
| MD5 |
0b7173e4d909e970da7dda392fddcbb3
|
|
| BLAKE2b-256 |
3c985b34e47394b2772be70c80b8d07c2ae2a0163e9c4c40a2b0a003a7cc1ada
|
Provenance
The following attestation bundles were made for file_mate-0.1.1-py3-none-any.whl:
Publisher:
pypi-publish.yml on Anshulgada/file-mate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
file_mate-0.1.1-py3-none-any.whl -
Subject digest:
8f9555e30cf0acb0c045cebd592a4c4359be0e94fe3d87a13e9a4e2af663ae5c - Sigstore transparency entry: 161862356
- Sigstore integration time:
-
Permalink:
Anshulgada/file-mate@1340cda3157bdbc7a61e783d69878d0af92b9d66 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Anshulgada
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@1340cda3157bdbc7a61e783d69878d0af92b9d66 -
Trigger Event:
push
-
Statement type: