mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-01-03 10:43:58 +02:00
Finalized BMP support
This commit is contained in:
parent
239ee95789
commit
1f73fd33a9
@ -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
|
||||
|
8
vips.c
8
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;
|
||||
|
4
vips.go
4
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))
|
||||
}
|
||||
|
2
vips.h
2
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();
|
||||
|
Loading…
Reference in New Issue
Block a user