Skip to main content

img2img: Image to Image

🔮快速转化图片格式

🚨更新日志:

  • v0.0.1 初始化项目,添加在命令行使用 jpg2png 方法;
  • v0.1.0 添加常见的 6 种转化方法;
  • v0.1.1 修复版本错误问题;
  • v0.1.2 回保存图片的路径;
  • v0.2.0 支持命令行批量转化。

1 功能

  1. 支持 6 种常见图片格式转化;
  2. 支持在命令行调用;
  3. 支持在网页上使用。

🔗点我访问

2 安装

2.1 使用 pip 安装

pip install img2img

2.2 从代码库安装

git clone https://github.com/Ailln/img2img.git
cd img2img
python setup.py install

3 使用

目前总共支持6种方法,如下:

  1. jpg2png
  2. png2jpg
  3. jpg2ico
  4. ico2jpg
  5. png2ico
  6. ico2png

下文中使用 jpg2png 作为演示,其他方法同理。

3.1 在代码中调用

# 在文件首部引入包
import img2img

# 查看版本
img2img.__version__
# output: 0.2.0

img = img2img.Img2img()

# 默认输出路径和输入路径相同
img.convert("jpg2png", "./test.jpg")

# 支持手动修改输出路径
img.convert("jpg2png", "./test.jpg", "../new_test.png")

3.2 在命令行中使用

# 默认输出路径和输入路径相同
jpg2png ./test.jpg

# 支持手动修改输出路径
jpg2png ./test.jpg ../new_test.png

# 支持文件夹批量转化
jpg2png ./test/

4 版本支持

  • 理论上支持 WindowsMacOSUbuntu 下的所有 Python 3.6 的版本。
  • 实际上仅在 Windows 10MacOS 10.14Ubuntu 16.04Python 3.6.3 上做过完整测试。
  • 欢迎提交其他版本使用情况到 Issues 中,期待你的反馈。
  • 如果你有 Python 2 的使用需求,可 Fork 代码自行修改。当然也欢迎提 PR,贡献自己代码给其他人。

5 协议

6 参考

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

img2img-0.2.0.tar.gz (58.3 kB view details)

Uploaded Source

File details

Details for the file img2img-0.2.0.tar.gz.

File metadata

  • Download URL: img2img-0.2.0.tar.gz
  • Upload date:
  • Size: 58.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for img2img-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c1565a35186110342461c670ef76cde9c1370909f2e078697b3c4fa549139ec8
MD5 182b7cd3f81e01c36ce741f01b83379f
BLAKE2b-256 d968bcd3c91ac30891d308fb76abdad3aee3c15fd0d989632730ee94f61d36e4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 file

0.1.2

1 file

0.1.1

1 file

0.0.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page