Class CompressOptions
-
- All Implemented Interfaces:
public final class CompressOptionsMedia 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)
-
-
Field Summary
Fields Modifier and Type Field Description private IntegerimageWidthprivate IntegerimageHeightprivate FloatimageQualityprivate IntegermaxOriginalImageSizeprivate IntegerthumbnailMaxSizeprivate IntegerthumbnailMinSizeprivate FloatthumbnailQualityprivate IntegersightCompressWidthprivate IntegersightCompressHeight
-
Constructor Summary
Constructors Constructor Description CompressOptions(Integer imageWidth, Integer imageHeight, Float imageQuality, Integer maxOriginalImageSize, Integer thumbnailMaxSize, Integer thumbnailMinSize, Float thumbnailQuality, Integer sightCompressWidth, Integer sightCompressHeight)
-
Method Summary
Modifier and Type Method Description final IntegergetImageWidth()Max width for the original image in pixels. final UnitsetImageWidth(Integer imageWidth)Max width for the original image in pixels. final IntegergetImageHeight()Max height for the original image in pixels. final UnitsetImageHeight(Integer imageHeight)Max height for the original image in pixels. final FloatgetImageQuality()Original image compression quality (0.0 ~ 1.0). final UnitsetImageQuality(Float imageQuality)Original image compression quality (0.0 ~ 1.0). final IntegergetMaxOriginalImageSize()Original image size threshold in KB. final UnitsetMaxOriginalImageSize(Integer maxOriginalImageSize)Original image size threshold in KB. final IntegergetThumbnailMaxSize()Max thumbnail edge length in pixels. final UnitsetThumbnailMaxSize(Integer thumbnailMaxSize)Max thumbnail edge length in pixels. final IntegergetThumbnailMinSize()Min thumbnail edge length in pixels. final UnitsetThumbnailMinSize(Integer thumbnailMinSize)Min thumbnail edge length in pixels. final FloatgetThumbnailQuality()Thumbnail compression quality (0.0 ~ 1.0). final UnitsetThumbnailQuality(Float thumbnailQuality)Thumbnail compression quality (0.0 ~ 1.0). final IntegergetSightCompressWidth()Short video (Sight) compressed width in pixels. final UnitsetSightCompressWidth(Integer sightCompressWidth)Short video (Sight) compressed width in pixels. final IntegergetSightCompressHeight()Short video (Sight) compressed height in pixels. final UnitsetSightCompressHeight(Integer sightCompressHeight)Short video (Sight) compressed height in pixels. -
-
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
-
-
-
-