瀏覽代碼

Remove HEIC saving; Remove JBIG from docker; Replace imagequant with quantizr in docker

DarthSim 5 年之前
父節點
當前提交
6c60fb804f
共有 10 個文件被更改,包括 42 次插入31 次删除
  1. 4 0
      CHANGELOG.md
  2. 33 8
      docker/Dockerfile
  3. 1 1
      docs/configuration.md
  4. 1 1
      docs/generating_the_url_advanced.md
  5. 1 1
      docs/generating_the_url_basic.md
  6. 1 3
      docs/image_formats_support.md
  7. 1 2
      process.go
  8. 0 12
      vips.c
  9. 0 2
      vips.go
  10. 0 1
      vips.h

+ 4 - 0
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

+ 33 - 8
docker/Dockerfile

@@ -3,6 +3,9 @@ LABEL maintainer="Sergey Alexandrovich <darthsim@gmail.com>"
 
 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

+ 1 - 1
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

+ 1 - 1
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.
 
 <img class="pro-badge" src="assets/pro.svg" alt="pro" /> Also you can yse `mp4` extension to convert animated images to MP4.
 

+ 1 - 1
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.
 
 <img class="pro-badge" src="assets/pro.svg" alt="pro" /> Also you can yse `mp4` extension to convert animated images to MP4.
 

+ 1 - 3
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)_ <img class="pro-badge" src="assets/pro.svg" alt="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.

+ 1 - 2
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
 }
 

+ 0 - 12
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

+ 0 - 2
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:

+ 0 - 1
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);