Giter VIP home page Giter VIP logo

img2img's Introduction

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 参考

img2img's People

Contributors

ailln avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

img2img's Issues

推荐支持批量模式

例如:jpg2png ./*.jpg 或者 jpg2png . 生成到当前目录
原因:找个命令一键处理,省的写脚本,否则这个命令和 mac 自带的 sips 没多少区别了

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.