All Projects → zoeDylan → z_img

zoeDylan / z_img

Licence: MIT License
图片操作工具,支持PNG,jpg,GIF【间接更新】

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to z img

tinypng-free
Use the upload api of tinypng's homeage to compress images
Stars: ✭ 29 (+26.09%)
Mutual labels:  tinypng, imagemin
image-optimisation-tools-comparison
A Benchmarking Suite for popular Image Optimisation Tools
Stars: ✭ 28 (+21.74%)
Mutual labels:  tinypng, imagemin
tinyimg-webpack-plugin
A webpack plugin for compressing image
Stars: ✭ 61 (+165.22%)
Mutual labels:  tinypng, imagemin
alfred-imagemin
Alfred workflow - Minify images with Imagemin
Stars: ✭ 29 (+26.09%)
Mutual labels:  imagemin
image-minimizer-webpack-plugin
Webpack loader and plugin to compress images using imagemin
Stars: ✭ 180 (+682.61%)
Mutual labels:  imagemin
bb8
Starter kit for automating tasks in everyday front-end development. 👨🏻‍💻 ⚡️ 🛠 ✨ 🤖
Stars: ✭ 13 (-43.48%)
Mutual labels:  imagemin
tinypng
A TinyPNG client written in Go
Stars: ✭ 21 (-8.7%)
Mutual labels:  tinypng
Tinypng4mac
TinyPNG client for Mac
Stars: ✭ 3,025 (+13052.17%)
Mutual labels:  tinypng
gulp-tinypng-compress
TinyPNG API wrapper for compressing PNG & JPG images
Stars: ✭ 49 (+113.04%)
Mutual labels:  tinypng
tinypng
基于TinyPNG图片压缩软件,操作简单高效,支持MacOS和Windows系统,无需其它依赖运行。
Stars: ✭ 83 (+260.87%)
Mutual labels:  tinypng
TinyPngPlugin
TinyPng gradle plugin for android
Stars: ✭ 240 (+943.48%)
Mutual labels:  tinypng
tinify-net
.NET client for the Tinify API.
Stars: ✭ 45 (+95.65%)
Mutual labels:  tinypng
AppThinning
Make app thinner. Help you find large files and compress png, gif, jpg, svg files. 应用程序瘦身工具,帮助你找到大文件,压缩png、gif、jpg、svg等文件。
Stars: ✭ 22 (-4.35%)
Mutual labels:  tinypng
TinyClient
🐙 Tinypng Windows/Mac/Linux 客户端,多 Key 自由配置
Stars: ✭ 37 (+60.87%)
Mutual labels:  tinypng
imagemin-gifsicle
Imagemin plugin for Gifsicle
Stars: ✭ 105 (+356.52%)
Mutual labels:  imagemin
Imagine
🖼️ PNG/JPEG optimization app for macOS, Windows and Linux.
Stars: ✭ 1,859 (+7982.61%)
Mutual labels:  tinypng
minify images
Optimiert Bilder mittels Media-Manager-Effekt über verschiedene Dienste (TinyPNG, ImageMagick, u.a.)
Stars: ✭ 29 (+26.09%)
Mutual labels:  tinypng
imagemin-power-cli
Optimize (compress) images with power using imagemin 💪
Stars: ✭ 13 (-43.48%)
Mutual labels:  imagemin
tinify-ruby
Ruby client for the Tinify API.
Stars: ✭ 41 (+78.26%)
Mutual labels:  tinypng
photoshop-scripts
Photoshop Scripts for the TinyPNG & TinyJPG Photoshop plugin
Stars: ✭ 43 (+86.96%)
Mutual labels:  tinypng

z_img

图片压缩工具【持续更新中】

重要更新

2017-11-28

命令行

  1. npm i -g zimg

  2. 定位文件夹,然后执行:zimg

zimg 压缩当前文件夹所有图片

zimg *.png *.jpg 压缩指定图片

作为压缩网站:

  1. npm i -g zimg

  2. zimg -r或者zimg -r 3000

自动打开浏览器窗口

作为项目调用

  1. npm i zimg --save

  2. const zimg = require('zimg');

  3. zimg(输入文件(arr或者string),输出文件夹路径);

功能说明

  1. cli命令

操作测试   2. 网页压缩图片

操作测试

流程说明

  • 图片压缩说明:
  1. 用户每次打开新的页面都会生成一个session

  2. 用户上传第一张图片时,生成session对应的文件夹,文件夹位于 lib/express/compass

  3. 同时生成2个文件夹lib/express/compass/{{文件名}}(存放源文件)和lib/express/compass/{{文件名}}/compass(存放压缩文件)

  4. 压缩后会返回图片的base64字符串,并添加了data:image/**;base64,数据头:lib/express/upload.js => (v.data = 'data:' + contentType + ';base64,' + v.data;)

  5. 数据返回用户后,lib/express/static/index.js => _zip.add(res.name, res.data);添加压缩文件

提示:由于jszip压缩的base64字符串不需要文件头,所以去掉文件头信息 lib/express/static/index.js => data.replace(/data.+base64,/, '')

lib/imagemin

图片压缩核心 仅对imagemin包进行了再次包装。

依赖包

imagemin

使用方式

cosnt imagemin = require('./lib/imagemin');

API

文件路径问题详情查看:imagemin

 cosnt imagemin = require('./lib/imagemin');

 //imagemin.compass(input,output);

 // input: 文件目录或者文件地址, './image/*.{jpg,png}' || './image/1.jpg' || ['./image/*.{jpg,png}','./image/1.jpg']

 // output: 文件输出目录 './image/compass' 默认:'imagemin/temp'

 imagemin.compass('./image/*.{jpg,png}','./image/compass')
    .then(v =>{
        if(v.status){
            console.log(v.data); //[{ data: buffer数据, path:图片路径 }] 路径为output所填路径加图片名称 './image/compass/1.jpg'
        }else{
            console.log(v.error); //错误消息
        }
    });

日志(时间倒叙)

2019-03-31

  1. 添加命令行队列处理,解决卡死问题

  2. 优化命令处理逻辑

2018-04-11

  1. 修改协议为MIT

2017-11-28

  1. 取消定位到文件夹进行网页压缩功能

  2. 增加命令行启动网页压缩功能

  3. 增加外部项目调用压缩功能

2017-09-19

  1. 添加cli命令处理

2017-09-15

  1. 新增GIF压缩

2017-09-14

  1. 清除多余包

  2. 取消co库,改为async await

2017-09-07

  1. 添加上传成功、失败提示

  2. 优化上传失败展示文案

  3. 修复图片上传报错问题

2017-05-08

  1. 添加数据展示信息

数据展示信息

  1. 优化用户文件夹创建时间,之前是在用户访问页面时创建文件夹,现在修改为用户上传第一张图片的时候创建,避免用户一直刷新。

  2. 用户已打开页面,但是服务器重启过,导致用户session失效,bug修复。

  3. 添加图片预览,添加图片后点击列表中的图片可以在独立标签打开页面预览图片。

  4. 图片限制30M,并发修改为1

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].