- #136, update the threshold crop to use color distance in the rgb cube
(3d distance) and normalize the threshold level from 0..1.0master
parent
421ff8387b
commit
dea4bed17b
|
@ -58,19 +58,7 @@ int main()
|
|||
return 1;
|
||||
}
|
||||
|
||||
im2 = gdImageThresholdCrop(im, 0xFFFFFF, 120);
|
||||
if (im2) {
|
||||
save_png(im2, "a3.png");
|
||||
gdImageDestroy(im2);
|
||||
}
|
||||
gdImageDestroy(im);
|
||||
|
||||
im = read_png("test_crop_threshold.png");
|
||||
if (!im) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
im2 = gdImageThresholdCrop(im, 0xFFFFFF, 70);
|
||||
im2 = gdImageThresholdCrop(im, 0xFFFFFF, 0.6);
|
||||
if (im2) {
|
||||
save_png(im2, "a4.png");
|
||||
gdImageDestroy(im2);
|
||||
|
|
2
src/gd.h
2
src/gd.h
|
@ -748,7 +748,7 @@ BGD_DECLARE(void) gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg);
|
|||
|
||||
BGD_DECLARE(gdImagePtr) gdImageCrop(gdImagePtr src, const gdRect *crop);
|
||||
BGD_DECLARE(gdImagePtr) gdImageAutoCrop(gdImagePtr im, const unsigned int mode);
|
||||
BGD_DECLARE(gdImagePtr) gdImageThresholdCrop(gdImagePtr im, const unsigned int color, const int threshold);
|
||||
BGD_DECLARE(gdImagePtr) gdImageThresholdCrop(gdImagePtr im, const unsigned int color, const float threshold);
|
||||
|
||||
BGD_DECLARE(void) gdImageFlipHorizontal(gdImagePtr im);
|
||||
BGD_DECLARE(void) gdImageFlipVertical(gdImagePtr im);
|
||||
|
|
Loading…
Reference in New Issue