tencent cloud

Feedback

Basic Image Processing

Last updated: 2022-06-15 11:18:08

    Overview

    COS has integrated Cloud Infinite (CI), a one-stop professional multimedia solution that offers the image processing features as outlined below. For more information, see Image Processing Overview.

    Service Feature Description
    Basic image processing Scaling Proportional scaling, scaling image to target width and height
    Cropping Regular cropping, cropping and scaling, inscribed circle cropping, intelligent face cropping
    Rotation Adaptive rotation, regular rotation
    Format conversion Format conversion, GIF format optimization, progressive display
    Quality change Quality change for JPG and WebP images
    Gaussian blurring Image blurring
    Sharpening Image sharpening
    Watermarking Image watermark, text watermark
    Image information acquisition Basic information, EXIF information, average hue
    Metadata removal Including EXIF information
    Quick thumbnail template Quick image format conversion, scaling, and cropping for thumbnail generation

    Basic Image Processing

    Below are some examples of basic image processing:

    Scaling

    String bucketName = "examplebucket-1250000000";
    String key = "qrcode.png";
    GetObjectRequest getObj = new GetObjectRequest(bucketName, key);
    // Scale the width and height to 50% of the original image
    String rule = "imageMogr2/thumbnail/!50p";
    getObj.putCustomQueryParameter(rule, null);
    cosClient.getObject(getObj, new File("qrcode-50p.png"));
    

    Cropping

    String bucketName = "examplebucket-1250000000";
    String key = "qrcode.png";
    GetObjectRequest getObj = new GetObjectRequest(bucketName, key);
    // Crop the radius of an inscribed circle to an integer greater than zero and less than half of the shorter side of the original image. The center of the inscribed circle is the center of the image.
    String rule = "imageMogr2/iradius/150";
    getObj.putCustomQueryParameter(rule, null);
    cosClient.getObject(getObj, new File("qrcode-cropping.png"));
    

    Rotation

    String bucketName = "examplebucket-1250000000";
    String key = "qrcode.png";
    GetObjectRequest getObj = new GetObjectRequest(bucketName, key);
    // Rotate clockwise by 90 degrees
    String rule = "imageMogr2/rotate/90";
    getObj.putCustomQueryParameter(rule, null);
    cosClient.getObject(getObj, new File("qrcode-rotate.png"));
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support