Name: resize-jpeg
Owner: TABLEFLIP
Description: :rainbow: Resize your jpeg and preserve it's original quality
Created: 2015-07-06 13:02:05.0
Updated: 2015-11-18 15:39:54.0
Pushed: 2015-08-09 08:28:00.0
Size: 140
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
You want to resize a jpeg? You want to preserve it's visual quality while doing so?
ze-jpeg -w 800 original.jpg > original.w800.jpg
mozjpeg
GraphicsMagick (and ImageMagick) dial down the quality of your JPEG files when you resize them.
That's surprising. mozjpeg
does a better job of optimising pixels for your eyes, and every byte counts, so instead:
ze-jpeg --minify -w 800 original.jpg > original.w800.min.jpg
That'll generally give a better output jpeg for fewer bytes. Win win!
Use a sensible package manager for you OS to install http://www.graphicsmagick.org/
Then use npm to install resize-jpeg
, globally as a command line tool.
install graphicsmagick
install -g resize-jpeg
ze-jpeg -w 800 path/to/my/picture
where -w
is the new width you'd like proportionally scale the image to.
Add a --minify
in there to engage mozjpeg minification magic.
Add it to your project
npm install --save resize-jpeg
Add you now have a transform stream that'll resize internet pugs on the fly:
fs = require('fs')
http = require('http')
resizeJpeg = require('resize-jpeg')
.get('http://aboutpug.com/wp-content/uploads/2015/01/flying-monkey-cute-pug.jpg')
n('response', function (resp) {
resp
.pipe(resizeJpeg(800))
.pipe(fs.createWriteStream('webpug.w800.jpg'))
or more simply, just resize jpegs from your local file system
fs = require('fs')
http = require('http')
resizeJpeg = require('resize-jpeg')
reateReadStream('flying-pug.jpg')
ipe(resizeJpeg(800))
ipe(fs.createWriteStream('pug.w800.jpg'))
Under the hood, resize-jpeg
is just doing the work of remembering the nasty gm command arguments for you. If you prefer to do it long hand, then it's the same as:
onvert original.jpg -resize 800x800 -define jpeg:preserve-settings - > original.w800.min.jpg
A (?°?°???TABLEFLIP side project.