{"id":18338772,"url":"https://github.com/tableflip/resize-jpeg","last_synced_at":"2025-04-09T20:35:53.810Z","repository":{"id":34651062,"uuid":"38619168","full_name":"tableflip/resize-jpeg","owner":"tableflip","description":":rainbow: Resize your jpeg and preserve it's original quality","archived":false,"fork":false,"pushed_at":"2015-08-09T08:28:00.000Z","size":140,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-15T12:46:46.806Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tableflip.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-06T13:02:05.000Z","updated_at":"2015-11-18T15:39:54.000Z","dependencies_parsed_at":"2022-09-14T17:31:36.690Z","dependency_job_id":null,"html_url":"https://github.com/tableflip/resize-jpeg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tableflip%2Fresize-jpeg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tableflip%2Fresize-jpeg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tableflip%2Fresize-jpeg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tableflip%2Fresize-jpeg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tableflip","download_url":"https://codeload.github.com/tableflip/resize-jpeg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248108387,"owners_count":21049127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T20:15:20.900Z","updated_at":"2025-04-09T20:35:53.786Z","avatar_url":"https://github.com/tableflip.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# resize-jpeg\n\nYou want to resize a jpeg? You want to preserve it's visual quality while doing so?\n\n```sh\nresize-jpeg -w 800 original.jpg \u003e original.w800.jpg\n```\n\n## Resize a jpeg and optimise for the web with `mozjpeg`\n\n[GraphicsMagick](http://www.graphicsmagick.org/) (and ImageMagick) dial down the quality of your JPEG files when you resize them.\n\nThat's surprising. [`mozjpeg`](https://npm.io/mozjpeg) does a better job of optimising pixels for your eyes, and every byte counts, so instead:\n\n```sh\nresize-jpeg --minify -w 800 original.jpg \u003e original.w800.min.jpg\n```\n\nThat'll generally give a better output jpeg for fewer bytes. Win win!\n\n## Get started\n\nUse a sensible package manager for you OS to install http://www.graphicsmagick.org/\nThen use npm to install `resize-jpeg`, globally as a command line tool.\n\n```sh\nbrew install graphicsmagick\nnpm install -g resize-jpeg\nresize-jpeg -w 800 path/to/my/picture\n```\nwhere `-w` is the new **width** you'd like proportionally scale the image to.\nAdd a `--minify` in there to engage mozjpeg minification magic.\n\n## Use it as a module!\n\nAdd it to your project\n`npm install --save resize-jpeg`\n\nAdd you now have a transform stream that'll resize internet pugs on the fly:\n\n```js\nvar fs = require('fs')\nvar http = require('http')\nvar resizeJpeg = require('resize-jpeg')\n\nhttp.get('http://aboutpug.com/wp-content/uploads/2015/01/flying-monkey-cute-pug.jpg')\n  .on('response', function (resp) {\n    resp\n      .pipe(resizeJpeg(800))\n      .pipe(fs.createWriteStream('webpug.w800.jpg'))\n  })\n```\n\nor more simply, just resize jpegs from your local file system\n\n```js\nvar fs = require('fs')\nvar http = require('http')\nvar resizeJpeg = require('resize-jpeg')\n\nfs.createReadStream('flying-pug.jpg')\n  .pipe(resizeJpeg(800))\n  .pipe(fs.createWriteStream('pug.w800.jpg'))\n```\n\n## How does it work?\n\nUnder 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:\n\n```sh\ngm convert original.jpg -resize 800x800 -define jpeg:preserve-settings - \u003e original.w800.min.jpg\n```\n\n---\n\nA [(╯°□°）╯︵TABLEFLIP](https://tableflip.io) side project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftableflip%2Fresize-jpeg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftableflip%2Fresize-jpeg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftableflip%2Fresize-jpeg/lists"}