Class CompressOptions

  • All Implemented Interfaces:

    
    public final class CompressOptions
    
                        

    Media compression options for images and short videos (Sight).

    Controls how images and short videos are compressed before sending. All properties have sensible defaults; only override the ones you need to customize.

    val compress = CompressOptions().apply {
        imageWidth = 1280
        imageHeight = 1280
        imageQuality = 0.82f
        maxOriginalImageSize = 300
        thumbnailMaxSize = 320
        thumbnailMinSize = 120
        thumbnailQuality = 0.35f
        sightCompressWidth = 720
        sightCompressHeight = 1280
    }
    
    val params = InitParams(context, "your-app-key").apply {
        compressOptions = compress
    }
    NCEngine.initialize(params)
    • Constructor Detail

      • CompressOptions

        CompressOptions(Integer imageWidth, Integer imageHeight, Float imageQuality, Integer maxOriginalImageSize, Integer thumbnailMaxSize, Integer thumbnailMinSize, Float thumbnailQuality, Integer sightCompressWidth, Integer sightCompressHeight)
    • Method Detail

      • getImageWidth

         final Integer getImageWidth()

        Max width for the original image in pixels.

        Images wider than this value will be scaled down proportionally. Default: 1080

      • setImageWidth

         final Unit setImageWidth(Integer imageWidth)

        Max width for the original image in pixels.

        Images wider than this value will be scaled down proportionally. Default: 1080

      • getImageHeight

         final Integer getImageHeight()

        Max height for the original image in pixels.

        Images taller than this value will be scaled down proportionally. Default: 1080

      • setImageHeight

         final Unit setImageHeight(Integer imageHeight)

        Max height for the original image in pixels.

        Images taller than this value will be scaled down proportionally. Default: 1080

      • getImageQuality

         final Float getImageQuality()

        Original image compression quality (0.0 ~ 1.0).

        Higher values produce better quality but larger file sizes. Default: 0.85

      • setImageQuality

         final Unit setImageQuality(Float imageQuality)

        Original image compression quality (0.0 ~ 1.0).

        Higher values produce better quality but larger file sizes. Default: 0.85

      • getMaxOriginalImageSize

         final Integer getMaxOriginalImageSize()

        Original image size threshold in KB.

        Images smaller than this value are sent without compression. Default: 200

      • setMaxOriginalImageSize

         final Unit setMaxOriginalImageSize(Integer maxOriginalImageSize)

        Original image size threshold in KB.

        Images smaller than this value are sent without compression. Default: 200

      • getThumbnailMaxSize

         final Integer getThumbnailMaxSize()

        Max thumbnail edge length in pixels.

        The longer edge of the thumbnail will not exceed this value. Default: 240

      • setThumbnailMaxSize

         final Unit setThumbnailMaxSize(Integer thumbnailMaxSize)

        Max thumbnail edge length in pixels.

        The longer edge of the thumbnail will not exceed this value. Default: 240

      • getThumbnailMinSize

         final Integer getThumbnailMinSize()

        Min thumbnail edge length in pixels.

        The shorter edge of the thumbnail will not be smaller than this value. Default: 100

      • setThumbnailMinSize

         final Unit setThumbnailMinSize(Integer thumbnailMinSize)

        Min thumbnail edge length in pixels.

        The shorter edge of the thumbnail will not be smaller than this value. Default: 100

      • getThumbnailQuality

         final Float getThumbnailQuality()

        Thumbnail compression quality (0.0 ~ 1.0).

        Default: 0.30

      • setThumbnailQuality

         final Unit setThumbnailQuality(Float thumbnailQuality)

        Thumbnail compression quality (0.0 ~ 1.0).

        Default: 0.30

      • getSightCompressWidth

         final Integer getSightCompressWidth()

        Short video (Sight) compressed width in pixels.

        Recommended to use multiples of 16. Default: 544

      • setSightCompressWidth

         final Unit setSightCompressWidth(Integer sightCompressWidth)

        Short video (Sight) compressed width in pixels.

        Recommended to use multiples of 16. Default: 544

      • getSightCompressHeight

         final Integer getSightCompressHeight()

        Short video (Sight) compressed height in pixels.

        Recommended to use multiples of 16. Default: 960

      • setSightCompressHeight

         final Unit setSightCompressHeight(Integer sightCompressHeight)

        Short video (Sight) compressed height in pixels.

        Recommended to use multiples of 16. Default: 960