Comments (4)
You could use imagemagick to resize then use mozjpeg to compress.
await spawn(bins.imagemagick) // input -> temp
await spawn(bins.mozjpeg) // temp -> output
from imagine.
To be more specific, I am just trying to reduce the dimensions by a percentage
from imagine.
So, on line 29 of index.ts I added '-resize 50%' which results in the code below. I am wokring with a JPEG. This does not seem to work, so I am missing something else down the line.
export const mozjpeg: IOptimizeMethod = (
input,
output,
options,
) => {
const { quality = 70 } = options
const spawnArgs = [
'-quality',
quality.toString(),
'-resize 50%',
'-outfile',
output,
input,
]
log.info('spawn', bins.mozjpeg, spawnArgs)
return spawn(bins.mozjpeg, spawnArgs, {
capture: [ 'stdout', 'stderr' ],
env: createEnv(),
}).catch(e => {
throw new Error(e.message + '\n' + e.stderr)
})
}
from imagine.
Just realized this method is not uing imagemagick (I had assuemed), but mozjpeg, whcih I am not familiar with, but does not seem to have a dimension (resize) option.
from imagine.
Related Issues (20)
- 360报毒 HOT 3
- 关于占用的问题抽空解决一下吧 HOT 12
- 重复启动软件后无法压缩 HOT 3
- 反馈一个关于删除文件的bug HOT 1
- 新版本无法保存文件
- 导入类型错误的图片会造成图片无法导入 HOT 1
- [Feature Request] 跳过体积变化不大的图片 HOT 2
- convert webp
- 提个需求,可以支持剪切板的图片吗? HOT 3
- 删除图片信息 HOT 3
- 清空增大文件文件菜单 可否增强下低于减少百分x 也清空 HOT 2
- png转mozjpeg后exif丢失了
- How to upgrade the pngquant lib version and moz-cjpeg lib version? HOT 3
- 要是能自动批量将图片压缩到设置的某个大小就好了 HOT 4
- mac M2 pro fail
- Add option to disable http request (and explain what it is) HOT 1
- 建议增加图像前后对比查看功能,比如这样| HOT 1
- 选择下载的微信“搜一搜公众号推广物料图片”后,软件不显示
- NFR: SVG optimization
- 可以增加一个小选项,是否移除exif信息么 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imagine.