diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e8a435c..c1a60093 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog ## [Unreleased] +## Changed +- Replaced imagequant with [Quantizr](https://github.com/DarthSim/quantizr) in docker image. +- Removed HEIC saving support. +- Removed JBIG compressin support in TIFF. ## [2.10.1] - 2020-02-27 ### Changed diff --git a/docker/Dockerfile b/docker/Dockerfile index 31ce26b1..9011ff80 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,6 +3,9 @@ LABEL maintainer="Sergey Alexandrovich " ARG VIPS_VERSION=8.9.1 ARG IMAGEMAGICK_VERSION=7.0.9-20 +ARG QUANTIZR_VERSION=0.1.0 +ARG LIBHEIF_VERSION=1.6.2 +ARG LIBTIFF_VERSION=4.1.0 ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig ENV LD_LIBRARY_PATH /lib64:/usr/lib64:/usr/local/lib @@ -15,8 +18,8 @@ RUN apt-get update \ git \ ca-certificates \ build-essential \ + cmake \ libtool \ - libfftw3-dev \ libglib2.0-dev \ libexpat1-dev \ libjpeg62-turbo-dev \ @@ -26,9 +29,32 @@ RUN apt-get update \ librsvg2-dev \ libexif-dev \ liblcms2-dev \ - libheif-dev \ - libtiff-dev \ - libimagequant-dev + libde265-dev \ + liblzma-dev + +# Install quantizr +RUN cd /root \ + && curl -Ls https://github.com/DarthSim/quantizr/releases/download/v$QUANTIZR_VERSION/quantizr-imagequant-compat_$QUANTIZR_VERSION-0.deb \ + > quantizr.deb \ + && apt-get install -y ./quantizr.deb + +# Build libheif +RUN cd /root \ + && curl -Ls https://github.com/strukturag/libheif/releases/download/v$LIBHEIF_VERSION/libheif-$LIBHEIF_VERSION.tar.gz | tar -xz \ + && cd libheif-$LIBHEIF_VERSION \ + && ./configure \ + --prefix=/usr/local \ + --disable-static \ + --disable-go \ + && make install-strip + +# Build libtiff +RUN cd /root \ + && curl -Ls https://gitlab.com/libtiff/libtiff/-/archive/v$LIBTIFF_VERSION/libtiff-v$LIBTIFF_VERSION.tar.gz | tar -xz \ + && cd libtiff-v$LIBTIFF_VERSION \ + && cmake . \ + && make \ + && make install # Build ImageMagick RUN cd /root \ @@ -93,7 +119,6 @@ RUN apt-get update \ bash \ ca-certificates \ libsm6 \ - libfftw3-3 \ libglib2.0-0 \ libexpat1 \ libjpeg62-turbo \ @@ -105,13 +130,13 @@ RUN apt-get update \ librsvg2-2 \ libexif12 \ liblcms2-2 \ - libheif1 \ - libtiff5 \ - libimagequant0 \ + libde265-0 \ + liblzma5 \ && rm -rf /var/lib/apt/lists/* COPY --from=0 /usr/local/bin/imgproxy /usr/local/bin/ COPY --from=0 /usr/local/lib /usr/local/lib +COPY --from=0 /usr/lib/libquantizr.so /usr/local/lib ENV VIPS_WARNING=0 ENV MALLOC_ARENA_MAX=2 diff --git a/docs/configuration.md b/docs/configuration.md index 68e0ed57..a975e2af 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -110,7 +110,7 @@ Also you may want imgproxy to respond with the same error message that it writes ### Advanced PNG compression * `IMGPROXY_PNG_INTERLACED`: when true, enables interlaced PNG compression. Default: false; -* `IMGPROXY_PNG_QUANTIZE`: when true, enables PNG quantization. libvips should be built with libimagequant support. Default: false; +* `IMGPROXY_PNG_QUANTIZE`: when true, enables PNG quantization. libvips should be built with [Quantizr](https://github.com/DarthSim/quantizr) or libimagequant support. Default: false; * `IMGPROXY_PNG_QUANTIZATION_COLORS`: maximum number of quantization palette entries. Should be between 2 and 256. Default: 256; ### Advanced GIF compression diff --git a/docs/generating_the_url_advanced.md b/docs/generating_the_url_advanced.md index a3851c45..049f64d8 100644 --- a/docs/generating_the_url_advanced.md +++ b/docs/generating_the_url_advanced.md @@ -464,7 +464,7 @@ When using encoded source URL, you can specify the [extension](#extension) after ### Extension -Extension specifies the format of the resulting image. At the moment, imgproxy supports only `jpg`, `png`, `webp`, `gif`, `ico`, `heic`, and `tiff`, them being the most popular and useful image formats. +Extension specifies the format of the resulting image. At the moment, imgproxy supports only `jpg`, `png`, `webp`, `gif`, `ico`, and `tiff`, them being the most popular and useful image formats. pro Also you can yse `mp4` extension to convert animated images to MP4. diff --git a/docs/generating_the_url_basic.md b/docs/generating_the_url_basic.md index 7d4a9b37..cfa97af0 100644 --- a/docs/generating_the_url_basic.md +++ b/docs/generating_the_url_basic.md @@ -87,7 +87,7 @@ When using encoded source URL, you can specify the [extension](#extension) after ### Extension -Extension specifies the format of the resulting image. At the moment, imgproxy supports only `jpg`, `png`, `webp`, `gif`, `ico`, `heic`, and `tiff`, them being the most popular and useful image formats. +Extension specifies the format of the resulting image. At the moment, imgproxy supports only `jpg`, `png`, `webp`, `gif`, `ico`, and `tiff`, them being the most popular and useful image formats. pro Also you can yse `mp4` extension to convert animated images to MP4. diff --git a/docs/image_formats_support.md b/docs/image_formats_support.md index 7c0b3f12..f0dd1c1b 100644 --- a/docs/image_formats_support.md +++ b/docs/image_formats_support.md @@ -9,7 +9,7 @@ At the moment, imgproxy supports only the most popular image formats: * ICO; * SVG; * MP4 _(result only)_ pro; -* HEIC; +* HEIC _(source only)_; * BMP; * TIFF. @@ -35,8 +35,6 @@ imgproxy reads some amount of bytes to check if the source image is SVG. By defa imgproxy supports HEIC only when using libvips 8.8.0+. Official imgproxy Docker image supports HEIC out of the box. -By default, imgproxy saves HEIC images as JPEG. You need to explicitly specify the `format` option to get HEIC output. - ## BMP support imgproxy supports BMP only when using libvips 8.7.0+ compiled with ImageMagick support. Official imgproxy Docker image supports ICO out of the box. diff --git a/process.go b/process.go index 43c781ce..903a2f65 100644 --- a/process.go +++ b/process.go @@ -26,8 +26,7 @@ func imageTypeSaveSupport(imgtype imageType) bool { } func imageTypeGoodForWeb(imgtype imageType) bool { - return imgtype != imageTypeHEIC && - imgtype != imageTypeTIFF && + return imgtype != imageTypeTIFF && imgtype != imageTypeBMP } diff --git a/vips.c b/vips.c index 59ef1c53..7e106dcd 100644 --- a/vips.c +++ b/vips.c @@ -107,8 +107,6 @@ vips_type_find_save_go(int imgtype) { return vips_type_find("VipsOperation", "magicksave_buffer"); case (ICO): return vips_type_find("VipsOperation", "magicksave_buffer"); - case (HEIC): - return vips_type_find("VipsOperation", "heifsave_buffer"); case (BMP): return vips_type_find("VipsOperation", "magicksave_buffer"); case (TIFF): @@ -568,16 +566,6 @@ vips_icosave_go(VipsImage *in, void **buf, size_t *len) { #endif } -int -vips_heifsave_go(VipsImage *in, void **buf, size_t *len, int quality) { -#if VIPS_SUPPORT_HEIF - return vips_heifsave_buffer(in, buf, len, "Q", quality, NULL); -#else - vips_error("vips_heifsave_go", "Saving HEIF is not supported (libvips 8.8+ reuired)"); - return 1; -#endif -} - int vips_tiffsave_go(VipsImage *in, void **buf, size_t *len, int quality) { #if VIPS_SUPPORT_TIFF diff --git a/vips.go b/vips.go index b6706c8c..8c5ee1b0 100644 --- a/vips.go +++ b/vips.go @@ -203,8 +203,6 @@ func (img *vipsImage) Save(imgtype imageType, quality int, stripMeta bool) ([]by err = C.vips_gifsave_go(img.VipsImage, &ptr, &imgsize) case imageTypeICO: err = C.vips_icosave_go(img.VipsImage, &ptr, &imgsize) - case imageTypeHEIC: - err = C.vips_heifsave_go(img.VipsImage, &ptr, &imgsize, C.int(quality)) case imageTypeBMP: err = C.vips_bmpsave_go(img.VipsImage, &ptr, &imgsize) case imageTypeTIFF: diff --git a/vips.h b/vips.h index 9cf2ee2f..12791515 100644 --- a/vips.h +++ b/vips.h @@ -87,7 +87,6 @@ int vips_pngsave_go(VipsImage *in, void **buf, size_t *len, int interlace, int q int vips_webpsave_go(VipsImage *in, void **buf, size_t *len, int quality, gboolean strip); int vips_gifsave_go(VipsImage *in, void **buf, size_t *len); int vips_icosave_go(VipsImage *in, void **buf, size_t *len); -int vips_heifsave_go(VipsImage *in, void **buf, size_t *len, int quality); int vips_bmpsave_go(VipsImage *in, void **buf, size_t *len); int vips_tiffsave_go(VipsImage *in, void **buf, size_t *len, int quality);