ResponsiveTransformation transformation = new ResponsiveTransformation(imageview);
CITransformation transform = new CITransformation();
// Scale the image’s width to 50% without changing the height.transform.thumbnailByWidthScale(50);// Scale the image’s height to 50% without changing the width.transform.thumbnailByHeightScale(50);// Scale both the image’s width and height to 50%.transform.thumbnailByScale(50);
// Scale the image’s width to 50 with the height scaled automatically.transform.thumbnailByWidth(50);// Scale the image’s height to 50 with the width scaled automatically.transform.thumbnailByHeight(50);// Set both the minimum width and height of the output image to 50 to scale the image.transform.thumbnailByMinWH(50, 50);// Set both the maximum width and height of the output image to 50 to scale the image.transform.thumbnailByMaxWH(50, 50);// Scale both the image’s width and height to 50 with the original aspect ratio ignored. Note that the image might be distorted.transform.thumbnailByWH(50, 50);
// Scale the image proportionally by limiting the total number of pixels of the output image to 1,000.transform.thumbnailByPixel(1000);
// Crop the image to the specified width and height (vertical and horizontal offsets relative to the upper-left vertex).transform.cut(100, 300, 30, 30);
radius specifies the radius of the inscribed circle. The value of radius should be an integer greater than 0 but smaller than half the length of the input image’s shorter side. The center of the inscribed circle is the center of the input image. This operation is not available for GIF images.// Set the radius to 100.transform.iradius(100);
radius specifies the radius of the rounded corners of an image. The value of radius should be an integer greater than 0 but smaller than half the length of the input image’s shorter side. The two sides of the input image are the tangent lines of the rounded corner. This operation is not available for GIF images.// Set the corner radius to 100.transform.rradius(100);
// Scale and crop the input image to the target width and height.transform.cropByWH(100, 100);// Scale and crop the input image to the target width and height with the reference point (CIGravity) specified.transform.cropByWH(100, 100, CIGravity.CENTER);// Scale and crop the input image to the target width.transform.cropByWidth(100);// Scale and crop the input image to the target width with the reference point (CIGravity) specified.transform.cropByWidth(100, CIGravity.CENTER);// Scale and crop the input image to the target height.transform.cropByHeight(100);// Scale and crop the input image to the target height with the reference point (CIGravity) specified.transform.cropByHeight(100, CIGravity.CENTER);
Width and Height respectively.// Crop the face from the image and scale both the width and height to 100.transform.scrop(100, 100);
// Rotate the image by 45 degrees.transform.rotate(45);
transform.rotate();
// Convert an image into JPEG.transform.format(CIImageFormat.JPEG, CIImageLoadOptions.LoadTypeUrlFooter);
// Loading option 1: Include the accept header (accept:image/xxx).LoadTypeAcceptHeader,// Loading option 2: Append imageMogr2/format/xxx to the URL.LoadTypeUrlFooter,
LoadTypeAcceptHeader and have specified other image processing rules, the header will not take effect. Instead, the SDK will use footer automatically.implementation 'com.tencent.qcloud:tpg:1.3.1'
build.gradle file to set the .so library frameworks that are supported.defaultConfig {ndk {// Set the .so library frameworks that are supported.abiFilters 'armeabi' //, 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'}}
FrameNumber).transform.gifOptimization(50);
transform.jpegInterlaceMode(true);
// Set the absolute quality of the image. Value range: 0−100. By default, the smaller value between the original image quality and the specified quality will be used.transform.quality(90);// Set the lowest quality of the output image. Value range: 0−100.// If the input image quality is 85 and `lquality` is set to 80, the quality of the output image is 85.// If the input image quality is 60 and `lquality` is set to 80, the quality of the output image will be improved to 80.transform.lowestQuality(90);// Set the relative quality of the image, relative to that of the input image. Value range: 0−100. For example, if the input image quality is 80 and `rquality` is set to `80`, the quality of the output image is 64 (that is, 80 x 80%).transform.relativelyQuality(80);
// Set the blur radius to 20 and the standard deviation of the normal distribution to 20.transform.blur(20, 20);
// Set the sharpening value to 70.transform.sharpen(70);
WatermarkImageTransform watermarkImageTransform = new WatermarkImageTransform// Set the URL of the image watermark..Builder(imageurl)// Set the reference point in the 3x3 grid position diagram..setGravity(CIGravity.CENTER)// Set the adaptation mode for an image watermark that is larger than the input image..setBlogo(1)// Set the horizontal offset..setDistanceX(10)// Set the vertical offset..setDistanceY(10).builder();transform.watermarkImage(watermarkImageTransform);
examplebucket-1250000000.file.myqcloud.com/shuiyin_2.png is unsupported) and be accessible. If the image watermark is set to private-read, it must carry a signature.http://. Note that "http://" cannot be omitted or changed to "https://". For example, examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/shuiyin_2.png and https://examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/shuiyin_2.png are invalid watermark URLs.WatermarkTextTransform watermarkImageTransform = new WatermarkTextTransform// Set the watermark text..Builder("Watermark")// Set the reference point in the 3x3 grid position diagram..setGravity(CIGravity.CENTER)// Set the font..setFont("tahoma.ttf")// Set the font size..setFontSize(13)// Set the text color..setFill("#FF0000")// Set the opacity of the watermark..setDissolve(80)// Set the horizontal offset..setDistanceX(10)// Set the vertical offset..setDistanceY(10)// Enable text watermark tiling to tile the watermark across the image..openBatch()// Rotate the watermark..rotate(45).builder();transform.watermarkText(watermarkImageTransform);
imageMogr2 API to remove image metadata, including the EXIF data. For the API documentation, please see Removing Image Metadata.transform.strip();
Transform can be used to perform multiple operations in order.transform.thumbnailByScale(80).iradius(100).blur(20,20).strip();
Feedback