String bucketName = "examplebucket-1250000000";String key = "qrcode.png";GetObjectRequest getObj = new GetObjectRequest(bucketName, key);// 宽高缩放为原图的50%String rule = "imageMogr2/thumbnail/!50p";getObj.putCustomQueryParameter(rule, null);cosClient.getObject(getObj, new File("qrcode-50p.png"));
String bucketName = "examplebucket-1250000000";String key = "qrcode.png";GetObjectRequest getObj = new GetObjectRequest(bucketName, key);// 裁剪内切圆的半径,取值范围为大于0且小于原图最小边一半的整数。内切圆的圆心为图片的中心String rule = "imageMogr2/iradius/150";getObj.putCustomQueryParameter(rule, null);cosClient.getObject(getObj, new File("qrcode-cropping.png"));
String bucketName = "examplebucket-1250000000";String key = "qrcode.png";GetObjectRequest getObj = new GetObjectRequest(bucketName, key);// 顺时针旋转90度String rule = "imageMogr2/rotate/90";getObj.putCustomQueryParameter(rule, null);cosClient.getObject(getObj, new File("qrcode-rotate.png"));
String bucketName = "examplebucket-1250000000";String key = "qrcode.png";GetObjectRequest getObj = new GetObjectRequest(bucketName, key);// 获取图片主色调String rule = "imageAve";COSObject object = cosClient.getObject(getObj);COSObjectInputStream objectContent = object.getObjectContent();
String bucketName = "examplebucket-1250000000";String key = "qrcode.png";GetObjectRequest getObj = new GetObjectRequest(bucketName, key);// 图片基本信息String rule = "imageInfo";getObj.putCustomQueryParameter(rule, null);COSObject object = cosClient.getObject(getObj);COSObjectInputStream objectContent = object.getObjectContent();
本页内容是否解决了您的问题?