resize method
Method for Basic Transformations
-
height
: height (Default: 0) -
width
: width (Default: 0) -
fit
: fit (Default: cover) -
background
: background (Default: "000000") -
position
: position (Default: center) -
algorithm
: algorithm (Default: lanczos3) -
dpr
: DPR (Default: 1)
Returns TransformationData.
Implementation
TransformationData resize(
int? height,
int? width,
Fit? fit,
String? background,
Position? position,
Algorithm? algorithm,
double? dpr,
) {
// Determine if there are values to add to the dictionary
var values = <String, String>{};
if (height != null) {
values['h'] = height.toString();
}
if (width != null) {
values['w'] = width.toString();
}
if (fit != null) {
values['f'] = fit.value;
}
if (background != null && background.isNotEmpty) {
values['b'] = background;
}
if (position != null) {
values['p'] = position.value;
}
if (algorithm != null) {
values['k'] = algorithm.value;
}
if (dpr != null) {
values['dpr'] = dpr.toString();
}
return TransformationData(plugin: 't', name: 'resize', values: values);
}