Pollexor

作为Thumbor图像服务的Java客户端,它允许您使用流畅API以富有表现力的方式构建URI。

查看Javadoc

创建Thumbor实例
// Without encryption:
Thumbor thumbor = Thumbor.create("http://example.com/");

// With encryption:
Thumbor thumbor = Thumbor.create("http://example.com/", "key");
简单缩放
thumbor.buildImage("http://example.com/image.png")
    .resize(48, 48)
    .toUrl()
缩放并智能裁剪
thumbor.buildImage("http://example.com/image.png")
    .crop(10, 10, 90, 90)
    .resize(40, 40)
    .smart()
    .toUrl()
缩放并使用方位/重心裁剪
thumbor.buildImage("http://example.com/image.png")
    .crop(5, 5, 195, 195)
    .resize(95, 95)
    .align(BOTTOM, RIGHT)
    .toUrl()
缩放并应用四种滤镜
thumbor.buildImage("http://example.com/background.png")
    .resize(200, 100)
    .filter(
        roundCorner(10),
        watermark(thumbor.buildImage("http://example.com/overlay1.png")),
        watermark(thumbor.buildImage("http://example.com/overlay2.png")),
        quality(85)
    )
    .toUrl()
图像格式
thumbor.buildImage("http://example.com/image.png")
    .resize(48, 48)
    .format(WEBP)
    .toUrl()
圆形图像
thumbor.buildImage("http://example.com/image.png")
    .resize(48, 48)
    .roundCorner(24)
    .toUrl()
Fork me on GitHub

by Square, Inc.