diff --git a/docs/image_formats_support.md b/docs/image_formats_support.md index 03037191..8bb12de0 100644 --- a/docs/image_formats_support.md +++ b/docs/image_formats_support.md @@ -28,6 +28,8 @@ By default, imgproxy saves HEIC images as JPEG. You need to explicitly specify t ## 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. + By default, imgproxy saves BMP images as JPEG. You need to explicitly specify the `format` option to get BMP output. ## Animated images support diff --git a/vips.c b/vips.c index 63570bd9..d8d7929b 100644 --- a/vips.c +++ b/vips.c @@ -109,7 +109,7 @@ vips_type_find_save_go(int imgtype) { case (HEIC): return vips_type_find("VipsOperation", "heifsave_buffer"); case (BMP): - return vips_type_find("VipsOperation", "bmpsave_buffer"); + return vips_type_find("VipsOperation", "magicksave_buffer"); case (TIFF): return vips_type_find("VipsOperation", "tiffsave_buffer"); } @@ -196,7 +196,7 @@ vips_bmpload_go(void *buf, size_t len, VipsImage **out) { return 1; #endif } - + int vips_tiffload_go(void *buf, size_t len, VipsImage **out) { #if VIPS_SUPPORT_TIFF @@ -544,9 +544,9 @@ vips_tiffsave_go(VipsImage *in, void **buf, size_t *len, int quality) { } int -vips_bmpsave_go(VipsImage *in, void **buf, size_t *len, int quality) { +vips_bmpsave_go(VipsImage *in, void **buf, size_t *len) { #if VIPS_SUPPORT_MAGICK - return vips_magicksave_buffer(in, buf, len, "format", "bmp", "quality", quality, NULL); + return vips_magicksave_buffer(in, buf, len, "format", "bmp", "quality", NULL); #else vips_error("vips_bmpsave_go", "Saving BMP is not supported"); return 1; diff --git a/vips.go b/vips.go index 919c6d6c..4552e5d3 100644 --- a/vips.go +++ b/vips.go @@ -124,7 +124,7 @@ func initVips() { } if int(C.vips_type_find_save_go(C.int(imageTypeBMP))) != 0 { vipsTypeSupportSave[imageTypeBMP] = true - } + } if int(C.vips_type_find_save_go(C.int(imageTypeTIFF))) != 0 { vipsTypeSupportSave[imageTypeTIFF] = true } @@ -253,7 +253,7 @@ func (img *vipsImage) Save(imgtype imageType, quality int) ([]byte, context.Canc 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, C.int(quality)) + err = C.vips_bmpsave_go(img.VipsImage, &ptr, &imgsize) case imageTypeTIFF: err = C.vips_tiffsave_go(img.VipsImage, &ptr, &imgsize, C.int(quality)) } diff --git a/vips.h b/vips.h index f36fa65b..191eae3f 100644 --- a/vips.h +++ b/vips.h @@ -88,7 +88,7 @@ int vips_webpsave_go(VipsImage *in, void **buf, size_t *len, int quality); 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 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); void vips_cleanup();