{"id":17234393,"url":"https://github.com/sija/thumb-cutter","last_synced_at":"2026-04-11T02:15:41.503Z","repository":{"id":25564513,"uuid":"28997797","full_name":"Sija/thumb-cutter","owner":"Sija","description":"Blazingly fast thumb cutting and image juggling middleware for any node/express.js kitchen sink","archived":false,"fork":false,"pushed_at":"2017-03-30T02:28:40.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T20:54:43.312Z","etag":null,"topics":["crop","expressjs","image-processing","javascript","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sija.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-01-09T02:59:38.000Z","updated_at":"2018-02-13T23:10:48.000Z","dependencies_parsed_at":"2022-08-24T06:30:50.422Z","dependency_job_id":null,"html_url":"https://github.com/Sija/thumb-cutter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sija%2Fthumb-cutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sija%2Fthumb-cutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sija%2Fthumb-cutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sija%2Fthumb-cutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sija","download_url":"https://codeload.github.com/Sija/thumb-cutter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245568570,"owners_count":20636803,"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":["crop","expressjs","image-processing","javascript","nodejs"],"created_at":"2024-10-15T05:29:18.729Z","updated_at":"2026-04-11T02:15:41.450Z","avatar_url":"https://github.com/Sija.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Thumb Cutter\n\nThumb Cutter slices your images with blazing speed (with the help of [sharp](https://github.com/lovell/sharp) library)! It comes as express.js middleware, so you can just plug it in and start using by adding query parameters onto a standard image url. It's ideal for web developers who would like to easily experiment with different thumbnail sizes generated on the go.\n\nYou can throw at it JPEG, PNG and WebP images. Colour spaces, embedded ICC profiles and alpha transparency channels are all handled correctly.\n\nSince Thumb Cutter is using [libvips image processing library](https://github.com/jcupitt/libvips) we're in for some benefits straight from Birkbeck College!\n\nQuoting from sharp's README:\n\n\u003e Only small regions of uncompressed image data are held in memory and processed at a time, taking full advantage of multiple CPU cores and L1/L2/L3 cache. Resizing an image is typically 4x faster than using the quickest ImageMagick and GraphicsMagick settings.\n\n\u003e Huffman tables are optimised when generating JPEG output images without having to use separate command line tools like jpegoptim and jpegtran. PNG filtering can be disabled, which for diagrams and line art often produces the same result as pngcrush.\n\n\u003e Everything remains non-blocking thanks to libuv, no child processes are spawned and Promises/A+ are supported.\n\n## Usage\n\n```js\nvar express = require('express'),\n    app = express(),\n    thumbCutter = require('thumb-cutter');\n\napp.use('/pictures', thumbCutter.static(__dirname + '/../pictures'));\n```\n\n```html\n\u003cimg src=\"/pictures/bw/photo.jpg?dim=200x100\u0026amp;rotate=true\" alt=\"\" /\u003e\n```\n\n## Install\n\n    npm install thumb-cutter\n\n`libvips` is required for this module, so make sure it is installed.\n\nDebian\n\n    apt-get install libvips libvips-dev libgsf-1-dev\n\nMac OS X\n\n    brew install vips\n\n## Documentation\n\n### thumbCutter.static(path, [options])\n\nMiddleware to replace `express.static()` or `connect.static()`.\n\n`path` is the base directory where images are located.\n\n`options` is an object to specify customizations. It currently has the following options:\n\n* `cacheDir` The directory where generated images will be created. (default: `[path]/.cache/`)\n* `quality` The output quality to use for lossy JPEG, WebP and TIFF output formats. (default: `80`)\n* `rotate` Rotate the output image by either an explicit angle or auto-orient based on the EXIF Orientation tag. (default: `false`)\n* `progressive` Use progressive (interlace) scan for JPEG and PNG output. (default: `true`)\n* `withMetadata` Include all metadata (EXIF, XMP, IPTC) from the input image in the output image. This will also convert to and add the latest web-friendly v2 sRGB ICC profile. (default: `false`)\n* `setHeaders` Callback with signature `function(res, filepath)`, called before `res.sendFile(filepath)`\n\nResizing of images is directed by the query parameter `dim`.  This is in the format [width]x[height]. E.g. `red.gif?dim=200x100`\n\nResized images will be created on an as needed basis, and stored in `cacheDir`.\n\nIf there is no parameters present, the original image will be served.\n\n### thumbCutter.convert(options, callback)\n\nThe first argument is an options object. callback argument is required.\n\n* `src` (required) Path to source image\n* `dst` (required) Path to destination image\n* `width` Width of resized image\n* `height` Height of resized image\n* `quality` The output quality to use for lossy JPEG, WebP and TIFF output formats.\n* `rotate` Rotate the output image by either an explicit angle or auto-orient based on the EXIF Orientation tag.\n* `progressive` Use progressive (interlace) scan for JPEG and PNG output.\n* `withMetadata` Include all metadata (EXIF, XMP, IPTC) from the input image in the output image. This will also convert to and add the latest web-friendly v2 sRGB ICC profile.\n\nThe callback argument gets 2 arguments. The first is an error object, most likely from sharp. The second argument is the path to the created image.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsija%2Fthumb-cutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsija%2Fthumb-cutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsija%2Fthumb-cutter/lists"}