mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-10-11 04:32:29 +02:00
Fallback to no profile while saving PNG if profile is invalid
This commit is contained in:
@@ -626,7 +626,10 @@ func vipsSaveImage(img *C.struct__VipsImage, imgtype imageType, quality int) ([]
|
|||||||
case imageTypeJPEG:
|
case imageTypeJPEG:
|
||||||
err = C.vips_jpegsave_go(img, &ptr, &imgsize, 1, C.int(quality), cConf.JpegProgressive)
|
err = C.vips_jpegsave_go(img, &ptr, &imgsize, 1, C.int(quality), cConf.JpegProgressive)
|
||||||
case imageTypePNG:
|
case imageTypePNG:
|
||||||
err = C.vips_pngsave_go(img, &ptr, &imgsize, cConf.PngInterlaced)
|
if err = C.vips_pngsave_go(img, &ptr, &imgsize, cConf.PngInterlaced, 1); err != 0 {
|
||||||
|
warning("Failed to save PNG; Trying not to embed icc profile")
|
||||||
|
err = C.vips_pngsave_go(img, &ptr, &imgsize, cConf.PngInterlaced, 0)
|
||||||
|
}
|
||||||
case imageTypeWEBP:
|
case imageTypeWEBP:
|
||||||
err = C.vips_webpsave_go(img, &ptr, &imgsize, 1, C.int(quality))
|
err = C.vips_webpsave_go(img, &ptr, &imgsize, 1, C.int(quality))
|
||||||
case imageTypeGIF:
|
case imageTypeGIF:
|
||||||
|
8
vips.h
8
vips.h
@@ -264,8 +264,12 @@ vips_jpegsave_go(VipsImage *in, void **buf, size_t *len, int strip, int quality,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
vips_pngsave_go(VipsImage *in, void **buf, size_t *len, int interlace) {
|
vips_pngsave_go(VipsImage *in, void **buf, size_t *len, int interlace, int embed_profile) {
|
||||||
return vips_pngsave_buffer(in, buf, len, "filter", VIPS_FOREIGN_PNG_FILTER_NONE, "interlace", interlace, NULL);
|
if (embed_profile) {
|
||||||
|
return vips_pngsave_buffer(in, buf, len, "filter", VIPS_FOREIGN_PNG_FILTER_NONE, "interlace", interlace, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return vips_pngsave_buffer(in, buf, len, "profile", "none", "filter", VIPS_FOREIGN_PNG_FILTER_NONE, "interlace", interlace, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Reference in New Issue
Block a user