1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-02-07 11:36:25 +02:00

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

This commit is contained in:
DarthSim 2020-03-12 20:03:29 +06:00
parent b4f030040c
commit 6c60fb804f
10 changed files with 42 additions and 31 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -26,8 +26,7 @@ func imageTypeSaveSupport(imgtype imageType) bool {
}
func imageTypeGoodForWeb(imgtype imageType) bool {
return imgtype != imageTypeHEIC &&
imgtype != imageTypeTIFF &&
return imgtype != imageTypeTIFF &&
imgtype != imageTypeBMP
}

12
vips.c
View File

@ -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

View File

@ -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:

1
vips.h
View File

@ -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);