Ghost/ghost/image-transform
Simon Backx 8b440b051f Added support for converting image types, gifs and svgs (#191)
refs https://github.com/TryGhost/Team/issues/1652
refs https://github.com/TryGhost/Ghost/issues/13319

- Added support for animated webp and gifs optimization and resizing
- Added optinal `format` option to `unsafeResizeFromBuffer` and `resizeFromBuffer`. E.g. allows you to convert a .svg file to a .png.
- Added optional `animated` option  to `unsafeResizeFromBuffer` and `resizeFromBuffer`. Defaults to 'maintain animation'.
- Added optional `withoutEnlargement` option  to `unsafeResizeFromBuffer` and `resizeFromBuffer`. Defaults to true. Required to increase SVG size.
- Removed gif and svg from `canTransformFileExtension`. They are supported by sharp now.
- Added `shouldResizeFileExtension` method, which returns if we should resize an image. This is required to prevent resizing SVG files (while it is supported, it is not desired), while allowing them to be converted to PNG (thats why a new method was needed).
- Added `canTransformToFormat` to validate the `format` option.
- Improved TS/JSDoc type inheritance when `makeSafe` is used.
2022-05-27 16:06:46 +02:00
..
lib Added support for converting image types, gifs and svgs (#191) 2022-05-27 16:06:46 +02:00
test Added support for converting image types, gifs and svgs (#191) 2022-05-27 16:06:46 +02:00
.eslintrc.js Remove trailing commas from .eslintrc.js files 2020-08-04 14:48:07 +01:00
index.js Updated paths & tests to work in new pkg structure 2020-03-25 14:48:41 +00:00
LICENSE 2022 2022-01-06 09:52:35 +00:00
package.json Published new versions 2022-05-24 13:06:28 +02:00
README.md 2022 2022-01-06 09:52:35 +00:00

Image Transform

Install

npm install @tryghost/image-transform --save

or

yarn add @tryghost/image-transform

Usage

Develop

This is a mono repository, managed with lerna.

Follow the instructions for the top-level repo.

  1. git clone this repo & cd into it as usual
  2. Run yarn to install top-level dependencies.

Run

  • yarn dev

Test

  • yarn lint run just eslint
  • yarn test run lint and tests

Copyright & License

Copyright (c) 2013-2022 Ghost Foundation - Released under the MIT license.