@softvision/webpdf-wsclient-typescript
Version:
A simplified and optimized API client library for the webPDF server
178 lines • 13.5 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImageOptimization = void 0;
class ImageOptimization {
constructor(data) {
let deskewDefault = true;
this.deskew = typeof (data === null || data === void 0 ? void 0 : data.deskew) !== "undefined" ? data === null || data === void 0 ? void 0 : data.deskew : deskewDefault;
let despeckleDefault = true;
this.despeckle = typeof (data === null || data === void 0 ? void 0 : data.despeckle) !== "undefined" ? data === null || data === void 0 ? void 0 : data.despeckle : despeckleDefault;
let edgeAccentuationDefault = "low";
this.edgeAccentuation = typeof (data === null || data === void 0 ? void 0 : data.edgeAccentuation) !== "undefined" ? data === null || data === void 0 ? void 0 : data.edgeAccentuation : edgeAccentuationDefault;
let edgeAccentuationValueDefault = 100;
this.edgeAccentuationValue = typeof (data === null || data === void 0 ? void 0 : data.edgeAccentuationValue) !== "undefined" ? data === null || data === void 0 ? void 0 : data.edgeAccentuationValue : edgeAccentuationValueDefault;
let gammaCorrectionDefault = "off";
this.gammaCorrection = typeof (data === null || data === void 0 ? void 0 : data.gammaCorrection) !== "undefined" ? data === null || data === void 0 ? void 0 : data.gammaCorrection : gammaCorrectionDefault;
let gammaCorrectionValueDefault = 0.0;
this.gammaCorrectionValue = typeof (data === null || data === void 0 ? void 0 : data.gammaCorrectionValue) !== "undefined" ? data === null || data === void 0 ? void 0 : data.gammaCorrectionValue : gammaCorrectionValueDefault;
let increaseContrastDefault = "off";
this.increaseContrast = typeof (data === null || data === void 0 ? void 0 : data.increaseContrast) !== "undefined" ? data === null || data === void 0 ? void 0 : data.increaseContrast : increaseContrastDefault;
let increaseContrastValueDefault = 0;
this.increaseContrastValue = typeof (data === null || data === void 0 ? void 0 : data.increaseContrastValue) !== "undefined" ? data === null || data === void 0 ? void 0 : data.increaseContrastValue : increaseContrastValueDefault;
let medianFilterDefault = "low";
this.medianFilter = typeof (data === null || data === void 0 ? void 0 : data.medianFilter) !== "undefined" ? data === null || data === void 0 ? void 0 : data.medianFilter : medianFilterDefault;
let medianFilterValueDefault = 1;
this.medianFilterValue = typeof (data === null || data === void 0 ? void 0 : data.medianFilterValue) !== "undefined" ? data === null || data === void 0 ? void 0 : data.medianFilterValue : medianFilterValueDefault;
let noiseReductionDefault = "low";
this.noiseReduction = typeof (data === null || data === void 0 ? void 0 : data.noiseReduction) !== "undefined" ? data === null || data === void 0 ? void 0 : data.noiseReduction : noiseReductionDefault;
let noiseReductionValueDefault = 1.0;
this.noiseReductionValue = typeof (data === null || data === void 0 ? void 0 : data.noiseReductionValue) !== "undefined" ? data === null || data === void 0 ? void 0 : data.noiseReductionValue : noiseReductionValueDefault;
let reduceDitheringDefault = false;
this.reduceDithering = typeof (data === null || data === void 0 ? void 0 : data.reduceDithering) !== "undefined" ? data === null || data === void 0 ? void 0 : data.reduceDithering : reduceDitheringDefault;
let sharpenDefault = "low";
this.sharpen = typeof (data === null || data === void 0 ? void 0 : data.sharpen) !== "undefined" ? data === null || data === void 0 ? void 0 : data.sharpen : sharpenDefault;
let sharpenValueDefault = 1.0;
this.sharpenValue = typeof (data === null || data === void 0 ? void 0 : data.sharpenValue) !== "undefined" ? data === null || data === void 0 ? void 0 : data.sharpenValue : sharpenValueDefault;
}
static getDeskewDefault() {
return true;
}
static getDeskewDescription() {
return "Straight scans of pages can be created with a slight skew. If this value is set to true, an attempt is made to counter-rotate this skew and thus \"deskew\" the page. The results of this manipulation are visible in the resulting document.";
}
static getDespeckleDefault() {
return true;
}
static getDespeckleDescription() {
return "If this mode is set, impurities and stains are reduced. These are caused, for example, by dust or dirt on the pane of a scanner. It is recommended to activate this optimization.";
}
static getEdgeAccentuationDefault() {
return "low";
}
static getEdgeAccentuationDescription() {
return "If this value is set, edge sharpening is applied to the image. This optimization usually leads to significantly better recognition results, but can also lead to information loss.\n\n* off = Do not apply this optimization\n* value = Select your own value\n* low = Apply optimization only with low intensity to avoid information loss.\n* medium = Perform optimization with medium intensity.\n* high = Perform optimization with strong intensity and accept possible information losses.";
}
static getEdgeAccentuationValueDefault() {
return 100;
}
static getEdgeAccentuationValueDescription() {
return "Allows in combination with the edgeAccentuation mode \"value\" the free choice of a value for this optimization. An integer percentage value indicates the intensity of the edge accentuation. The actual image is overlaid with a corresponding sharpening filter for the edge accentuation - this percentage value specifies how intensively this effect should be emphasized compared to the original image. The predefined values range between 100 (low) and 200 percent (high).";
}
static getEdgeAccentuationValueMin() {
return 0;
}
static getGammaCorrectionDefault() {
return "off";
}
static getGammaCorrectionDescription() {
return "If this value is set, edge sharpening is applied to the image. This optimization usually leads to significantly better recognition results, but can also lead to information loss.\n\n* off = Do not apply this optimization\n* value = Select your own value\n* low = Apply optimization only with low intensity to avoid information loss.\n* medium = Perform optimization with medium intensity.\n* high = Perform optimization with strong intensity and accept possible information losses.";
}
static getGammaCorrectionValueDefault() {
return 0.0;
}
static getGammaCorrectionValueDescription() {
return "Allows in combination with the gammaCorrection mode \"value\" the free choice of a value for this optimization. A comma value greater than 0 specifies the value to be applied to the image as gamma correction. The predefined values range between 1.5 (low) and 2.5 (high).";
}
static getGammaCorrectionValueMin() {
return 0;
}
static getIncreaseContrastDefault() {
return "off";
}
static getIncreaseContrastDescription() {
return "If this value is set, edge sharpening is applied to the image. This optimization usually leads to significantly better recognition results, but can also lead to information loss.\n\n* off = Do not apply this optimization\n* value = Select your own value\n* low = Apply optimization only with low intensity to avoid information loss.\n* medium = Perform optimization with medium intensity.\n* high = Perform optimization with strong intensity and accept possible information losses.";
}
static getIncreaseContrastValueDefault() {
return 0;
}
static getIncreaseContrastValueDescription() {
return "Allows in combination with the increaseContrast mode \"value\" the free choice of a value for this optimization. An integer value between -100 and +100 specifies the intensity of the contrast enhancement. The predefined values range between 25 (low) and 75 (high).";
}
static getIncreaseContrastValueMin() {
return -100;
}
static getIncreaseContrastValueMax() {
return 100;
}
static getMedianFilterDefault() {
return "low";
}
static getMedianFilterDescription() {
return "If this value is set, edge sharpening is applied to the image. This optimization usually leads to significantly better recognition results, but can also lead to information loss.\n\n* off = Do not apply this optimization\n* value = Select your own value\n* low = Apply optimization only with low intensity to avoid information loss.\n* medium = Perform optimization with medium intensity.\n* high = Perform optimization with strong intensity and accept possible information losses.";
}
static getMedianFilterValueDefault() {
return 1;
}
static getMedianFilterValueDescription() {
return "Allows, in combination with the medianFilter mode \"value\", the free choice of a value for this optimization. An integer value greater than 0 specifies the grid size with which the effect is to be applied to the image. The predefined values range between 1 (low) and 3 (high).";
}
static getMedianFilterValueMin() {
return 0;
}
static getNoiseReductionDefault() {
return "low";
}
static getNoiseReductionDescription() {
return "If this value is set, edge sharpening is applied to the image. This optimization usually leads to significantly better recognition results, but can also lead to information loss.\n\n* off = Do not apply this optimization\n* value = Select your own value\n* low = Apply optimization only with low intensity to avoid information loss.\n* medium = Perform optimization with medium intensity.\n* high = Perform optimization with strong intensity and accept possible information losses.";
}
static getNoiseReductionValueDefault() {
return 1.0;
}
static getNoiseReductionValueDescription() {
return "Allows in combination with the noiseReduction mode \"value\" the free choice of a value for this optimization. A decimal value greater than 0 indicates the intensity with which the effect is to be applied to the image. The predefined values range between 1.0 (low) and 3.0 (high).";
}
static getNoiseReductionValueMin() {
return 0;
}
static getReduceDitheringDefault() {
return false;
}
static getReduceDitheringDescription() {
return "In black and white images (including black and white scans), color values are often represented by a halftone according to their brightness (dithering \/ moir\u00E9 effect). These halftones\/hatchings translate a color value into a uniform sequence of black and white areas that visually appear to be a uniform area of the same color\/brightness. Such patterns can be very difficult to delineate against actual text that may be in such a \"colored\" area. Setting this value to true will try to reduce such dithering patterns. This mode should only be set if absolutely necessary, as this process can be very lossy.";
}
static getSharpenDefault() {
return "low";
}
static getSharpenDescription() {
return "If this value is set, edge sharpening is applied to the image. This optimization usually leads to significantly better recognition results, but can also lead to information loss.\n\n* off = Do not apply this optimization\n* value = Select your own value\n* low = Apply optimization only with low intensity to avoid information loss.\n* medium = Perform optimization with medium intensity.\n* high = Perform optimization with strong intensity and accept possible information losses.";
}
static getSharpenValueDefault() {
return 1.0;
}
static getSharpenValueDescription() {
return "Allows in combination with the sharpen mode \"value\" the free choice of a value for this optimization. A comma value greater than 0 indicates the intensity with which the effect is to be applied to the image. The predefined values range between 1.0 (low) and 3.0 (high).";
}
static getSharpenValueMin() {
return 0;
}
static fromJson(data) {
if (data === undefined || data === null) {
return data;
}
return new ImageOptimization(data);
}
toJson() {
return {
'deskew': this.deskew,
'despeckle': this.despeckle,
'edgeAccentuation': this.edgeAccentuation,
'edgeAccentuationValue': this.edgeAccentuationValue,
'gammaCorrection': this.gammaCorrection,
'gammaCorrectionValue': this.gammaCorrectionValue,
'increaseContrast': this.increaseContrast,
'increaseContrastValue': this.increaseContrastValue,
'medianFilter': this.medianFilter,
'medianFilterValue': this.medianFilterValue,
'noiseReduction': this.noiseReduction,
'noiseReductionValue': this.noiseReductionValue,
'reduceDithering': this.reduceDithering,
'sharpen': this.sharpen,
'sharpenValue': this.sharpenValue,
};
}
clone() {
return ImageOptimization.fromJson(this.toJson());
}
}
exports.ImageOptimization = ImageOptimization;
//# sourceMappingURL=ImageOptimization.js.map