| @@ 17-331 (lines=315) @@ | ||
| 14 | * |
|
| 15 | * @package GravityMedia\Ghostscript\Devices\DistillerParameters |
|
| 16 | */ |
|
| 17 | trait ColorImageCompressionTrait |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * Available color image downsample type values |
|
| 21 | * |
|
| 22 | * @var string[] |
|
| 23 | */ |
|
| 24 | protected static $colorImageDownsampleTypeValues = [ |
|
| 25 | DistillerParametersInterface::IMAGE_DOWNSAMPLE_TYPE_AVERAGE, |
|
| 26 | DistillerParametersInterface::IMAGE_DOWNSAMPLE_TYPE_BICUBIC, |
|
| 27 | DistillerParametersInterface::IMAGE_DOWNSAMPLE_TYPE_SUBSAMPLE, |
|
| 28 | DistillerParametersInterface::IMAGE_DOWNSAMPLE_TYPE_NONE, |
|
| 29 | ]; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * Available color image filter values |
|
| 33 | * |
|
| 34 | * @var string[] |
|
| 35 | */ |
|
| 36 | protected static $colorImageFilterValues = [ |
|
| 37 | DistillerParametersInterface::IMAGE_FILTER_DCT_ENCODE, |
|
| 38 | DistillerParametersInterface::IMAGE_FILTER_FLATE_ENCODE |
|
| 39 | ]; |
|
| 40 | ||
| 41 | /** |
|
| 42 | * Get argument value |
|
| 43 | * |
|
| 44 | * @param string $name |
|
| 45 | * |
|
| 46 | * @return string |
|
| 47 | */ |
|
| 48 | abstract protected function getArgumentValue($name); |
|
| 49 | ||
| 50 | /** |
|
| 51 | * Set argument |
|
| 52 | * |
|
| 53 | * @param string $argument |
|
| 54 | * |
|
| 55 | * @return $this |
|
| 56 | */ |
|
| 57 | abstract protected function setArgument($argument); |
|
| 58 | ||
| 59 | /** |
|
| 60 | * Whether to anti alias color images |
|
| 61 | * |
|
| 62 | * @return bool |
|
| 63 | */ |
|
| 64 | public function isAntiAliasColorImages() |
|
| 65 | { |
|
| 66 | $value = $this->getArgumentValue('-dAntiAliasColorImages'); |
|
| 67 | if (null === $value) { |
|
| 68 | return false; |
|
| 69 | } |
|
| 70 | ||
| 71 | return filter_var($value, FILTER_VALIDATE_BOOLEAN); |
|
| 72 | } |
|
| 73 | ||
| 74 | /** |
|
| 75 | * Set anti alias color images flag |
|
| 76 | * |
|
| 77 | * @param bool $antiAliasColorImages |
|
| 78 | * |
|
| 79 | * @return $this |
|
| 80 | */ |
|
| 81 | public function setAntiAliasColorImages($antiAliasColorImages) |
|
| 82 | { |
|
| 83 | $this->setArgument(sprintf('-dAntiAliasColorImages=%s', $antiAliasColorImages ? 'true' : 'false')); |
|
| 84 | ||
| 85 | return $this; |
|
| 86 | } |
|
| 87 | ||
| 88 | /** |
|
| 89 | * Whether to auto filter color images |
|
| 90 | * |
|
| 91 | * @return bool |
|
| 92 | */ |
|
| 93 | public function isAutoFilterColorImages() |
|
| 94 | { |
|
| 95 | $value = $this->getArgumentValue('-dAutoFilterColorImages'); |
|
| 96 | if (null === $value) { |
|
| 97 | return true; |
|
| 98 | } |
|
| 99 | ||
| 100 | return filter_var($value, FILTER_VALIDATE_BOOLEAN); |
|
| 101 | } |
|
| 102 | ||
| 103 | /** |
|
| 104 | * Set auto filter color images flag |
|
| 105 | * |
|
| 106 | * @param bool $autoFilterColorImages |
|
| 107 | * |
|
| 108 | * @return $this |
|
| 109 | */ |
|
| 110 | public function setAutoFilterColorImages($autoFilterColorImages) |
|
| 111 | { |
|
| 112 | $this->setArgument(sprintf('-dAutoFilterColorImages=%s', $autoFilterColorImages ? 'true' : 'false')); |
|
| 113 | ||
| 114 | return $this; |
|
| 115 | } |
|
| 116 | ||
| 117 | /** |
|
| 118 | * Get color image depth |
|
| 119 | * |
|
| 120 | * @return int |
|
| 121 | */ |
|
| 122 | public function getColorImageDepth() |
|
| 123 | { |
|
| 124 | $value = $this->getArgumentValue('-dColorImageDepth'); |
|
| 125 | if (null === $value) { |
|
| 126 | return -1; |
|
| 127 | } |
|
| 128 | ||
| 129 | return intval($value); |
|
| 130 | } |
|
| 131 | ||
| 132 | /** |
|
| 133 | * Set color image depth |
|
| 134 | * |
|
| 135 | * @param int $colorImageDepth |
|
| 136 | * |
|
| 137 | * @return $this |
|
| 138 | */ |
|
| 139 | public function setColorImageDepth($colorImageDepth) |
|
| 140 | { |
|
| 141 | $this->setArgument(sprintf('-dColorImageDepth=%s', $colorImageDepth)); |
|
| 142 | ||
| 143 | return $this; |
|
| 144 | } |
|
| 145 | ||
| 146 | /** |
|
| 147 | * Get color image downsample threshold |
|
| 148 | * |
|
| 149 | * @return float |
|
| 150 | */ |
|
| 151 | public function getColorImageDownsampleThreshold() |
|
| 152 | { |
|
| 153 | $value = $this->getArgumentValue('-dColorImageDownsampleThreshold'); |
|
| 154 | if (null === $value) { |
|
| 155 | return 1.5; |
|
| 156 | } |
|
| 157 | ||
| 158 | return floatval($value); |
|
| 159 | } |
|
| 160 | ||
| 161 | /** |
|
| 162 | * Set color image downsample threshold |
|
| 163 | * |
|
| 164 | * @param float $colorImageDownsampleThreshold |
|
| 165 | * |
|
| 166 | * @return $this |
|
| 167 | */ |
|
| 168 | public function setColorImageDownsampleThreshold($colorImageDownsampleThreshold) |
|
| 169 | { |
|
| 170 | $this->setArgument(sprintf('-dColorImageDownsampleThreshold=%s', $colorImageDownsampleThreshold)); |
|
| 171 | ||
| 172 | return $this; |
|
| 173 | } |
|
| 174 | ||
| 175 | /** |
|
| 176 | * Get color image downsample type |
|
| 177 | * |
|
| 178 | * @return string |
|
| 179 | */ |
|
| 180 | public function getColorImageDownsampleType() |
|
| 181 | { |
|
| 182 | $value = $this->getArgumentValue('-dColorImageDownsampleType'); |
|
| 183 | if (null === $value) { |
|
| 184 | return DistillerParametersInterface::IMAGE_DOWNSAMPLE_TYPE_SUBSAMPLE; |
|
| 185 | } |
|
| 186 | ||
| 187 | return substr($value, 1); |
|
| 188 | } |
|
| 189 | ||
| 190 | /** |
|
| 191 | * Set color image downsample type |
|
| 192 | * |
|
| 193 | * @param string $colorImageDownsampleType |
|
| 194 | * |
|
| 195 | * @throws \InvalidArgumentException |
|
| 196 | * |
|
| 197 | * @return $this |
|
| 198 | */ |
|
| 199 | public function setColorImageDownsampleType($colorImageDownsampleType) |
|
| 200 | { |
|
| 201 | if (!in_array($colorImageDownsampleType, static::$colorImageDownsampleTypeValues)) { |
|
| 202 | throw new \InvalidArgumentException('Invalid color image downsample type argument'); |
|
| 203 | } |
|
| 204 | ||
| 205 | $this->setArgument(sprintf('-dColorImageDownsampleType=/%s', $colorImageDownsampleType)); |
|
| 206 | ||
| 207 | return $this; |
|
| 208 | } |
|
| 209 | ||
| 210 | /** |
|
| 211 | * Get color image filter |
|
| 212 | * |
|
| 213 | * @return string |
|
| 214 | */ |
|
| 215 | public function getColorImageFilter() |
|
| 216 | { |
|
| 217 | $value = $this->getArgumentValue('-dColorImageFilter'); |
|
| 218 | if (null === $value) { |
|
| 219 | return DistillerParametersInterface::IMAGE_FILTER_DCT_ENCODE; |
|
| 220 | } |
|
| 221 | ||
| 222 | return substr($value, 1); |
|
| 223 | } |
|
| 224 | ||
| 225 | /** |
|
| 226 | * Set color image filter |
|
| 227 | * |
|
| 228 | * @param string $colorImageFilter |
|
| 229 | * |
|
| 230 | * @throws \InvalidArgumentException |
|
| 231 | * |
|
| 232 | * @return $this |
|
| 233 | */ |
|
| 234 | public function setColorImageFilter($colorImageFilter) |
|
| 235 | { |
|
| 236 | if (!in_array($colorImageFilter, static::$colorImageFilterValues)) { |
|
| 237 | throw new \InvalidArgumentException('Invalid color image filter argument'); |
|
| 238 | } |
|
| 239 | ||
| 240 | $this->setArgument(sprintf('-dColorImageFilter=/%s', $colorImageFilter)); |
|
| 241 | ||
| 242 | return $this; |
|
| 243 | } |
|
| 244 | ||
| 245 | /** |
|
| 246 | * Get color image resolution |
|
| 247 | * |
|
| 248 | * @return int |
|
| 249 | */ |
|
| 250 | public function getColorImageResolution() |
|
| 251 | { |
|
| 252 | $value = $this->getArgumentValue('-dColorImageResolution'); |
|
| 253 | if (null === $value) { |
|
| 254 | return 72; |
|
| 255 | } |
|
| 256 | ||
| 257 | return intval($value); |
|
| 258 | } |
|
| 259 | ||
| 260 | /** |
|
| 261 | * Set color image resolution |
|
| 262 | * |
|
| 263 | * @param int $colorImageResolution |
|
| 264 | * |
|
| 265 | * @return $this |
|
| 266 | */ |
|
| 267 | public function setColorImageResolution($colorImageResolution) |
|
| 268 | { |
|
| 269 | $this->setArgument(sprintf('-dColorImageResolution=%s', $colorImageResolution)); |
|
| 270 | ||
| 271 | return $this; |
|
| 272 | } |
|
| 273 | ||
| 274 | /** |
|
| 275 | * Whether to downsample color images |
|
| 276 | * |
|
| 277 | * @return bool |
|
| 278 | */ |
|
| 279 | public function isDownsampleColorImages() |
|
| 280 | { |
|
| 281 | $value = $this->getArgumentValue('-dDownsampleColorImages'); |
|
| 282 | if (null === $value) { |
|
| 283 | return false; |
|
| 284 | } |
|
| 285 | ||
| 286 | return filter_var($value, FILTER_VALIDATE_BOOLEAN); |
|
| 287 | } |
|
| 288 | ||
| 289 | /** |
|
| 290 | * Set downsample color images flag |
|
| 291 | * |
|
| 292 | * @param bool $downsampleColorImages |
|
| 293 | * |
|
| 294 | * @return $this |
|
| 295 | */ |
|
| 296 | public function setDownsampleColorImages($downsampleColorImages) |
|
| 297 | { |
|
| 298 | $this->setArgument(sprintf('-dDownsampleColorImages=%s', $downsampleColorImages ? 'true' : 'false'));; |
|
| 299 | ||
| 300 | return $this; |
|
| 301 | } |
|
| 302 | ||
| 303 | /** |
|
| 304 | * Whether to encode color images |
|
| 305 | * |
|
| 306 | * @return bool |
|
| 307 | */ |
|
| 308 | public function isEncodeColorImages() |
|
| 309 | { |
|
| 310 | $value = $this->getArgumentValue('-dEncodeColorImages'); |
|
| 311 | if (null === $value) { |
|
| 312 | return true; |
|
| 313 | } |
|
| 314 | ||
| 315 | return filter_var($value, FILTER_VALIDATE_BOOLEAN); |
|
| 316 | } |
|
| 317 | ||
| 318 | /** |
|
| 319 | * Set encode color images flag |
|
| 320 | * |
|
| 321 | * @param bool $encodeColorImages |
|
| 322 | * |
|
| 323 | * @return $this |
|
| 324 | */ |
|
| 325 | public function setEncodeColorImages($encodeColorImages) |
|
| 326 | { |
|
| 327 | $this->setArgument(sprintf('-dEncodeColorImages=%s', $encodeColorImages ? 'true' : 'false')); |
|
| 328 | ||
| 329 | return $this; |
|
| 330 | } |
|
| 331 | } |
|
| 332 | ||
| @@ 17-331 (lines=315) @@ | ||
| 14 | * |
|
| 15 | * @package GravityMedia\Ghostscript\Devices\DistillerParameters |
|
| 16 | */ |
|
| 17 | trait GrayscaleImageCompressionTrait |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * Available grayscale image downsample type values |
|
| 21 | * |
|
| 22 | * @var string[] |
|
| 23 | */ |
|
| 24 | protected static $grayImageDownsampleTypeValues = [ |
|
| 25 | DistillerParametersInterface::IMAGE_DOWNSAMPLE_TYPE_AVERAGE, |
|
| 26 | DistillerParametersInterface::IMAGE_DOWNSAMPLE_TYPE_BICUBIC, |
|
| 27 | DistillerParametersInterface::IMAGE_DOWNSAMPLE_TYPE_SUBSAMPLE, |
|
| 28 | DistillerParametersInterface::IMAGE_DOWNSAMPLE_TYPE_NONE, |
|
| 29 | ]; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * Available grayscale image filter values |
|
| 33 | * |
|
| 34 | * @var string[] |
|
| 35 | */ |
|
| 36 | protected static $grayImageFilterValues = [ |
|
| 37 | DistillerParametersInterface::IMAGE_FILTER_DCT_ENCODE, |
|
| 38 | DistillerParametersInterface::IMAGE_FILTER_FLATE_ENCODE |
|
| 39 | ]; |
|
| 40 | ||
| 41 | /** |
|
| 42 | * Get argument value |
|
| 43 | * |
|
| 44 | * @param string $name |
|
| 45 | * |
|
| 46 | * @return string |
|
| 47 | */ |
|
| 48 | abstract protected function getArgumentValue($name); |
|
| 49 | ||
| 50 | /** |
|
| 51 | * Set argument |
|
| 52 | * |
|
| 53 | * @param string $argument |
|
| 54 | * |
|
| 55 | * @return $this |
|
| 56 | */ |
|
| 57 | abstract protected function setArgument($argument); |
|
| 58 | ||
| 59 | /** |
|
| 60 | * Whether to anti alias grayscale images |
|
| 61 | * |
|
| 62 | * @return bool |
|
| 63 | */ |
|
| 64 | public function isAntiAliasGrayImages() |
|
| 65 | { |
|
| 66 | $value = $this->getArgumentValue('-dAntiAliasGrayImages'); |
|
| 67 | if (null === $value) { |
|
| 68 | return false; |
|
| 69 | } |
|
| 70 | ||
| 71 | return filter_var($value, FILTER_VALIDATE_BOOLEAN); |
|
| 72 | } |
|
| 73 | ||
| 74 | /** |
|
| 75 | * Set anti alias grayscale images flag |
|
| 76 | * |
|
| 77 | * @param bool $antiAliasGrayImages |
|
| 78 | * |
|
| 79 | * @return $this |
|
| 80 | */ |
|
| 81 | public function setAntiAliasGrayImages($antiAliasGrayImages) |
|
| 82 | { |
|
| 83 | $this->setArgument(sprintf('-dAntiAliasGrayImages=%s', $antiAliasGrayImages ? 'true' : 'false')); |
|
| 84 | ||
| 85 | return $this; |
|
| 86 | } |
|
| 87 | ||
| 88 | /** |
|
| 89 | * Whether to auto filter grayscale images |
|
| 90 | * |
|
| 91 | * @return bool |
|
| 92 | */ |
|
| 93 | public function isAutoFilterGrayImages() |
|
| 94 | { |
|
| 95 | $value = filter_var($this->getArgumentValue('-dAutoFilterGrayImages'), FILTER_VALIDATE_BOOLEAN); |
|
| 96 | if (null === $value) { |
|
| 97 | return true; |
|
| 98 | } |
|
| 99 | ||
| 100 | return filter_var($value, FILTER_VALIDATE_BOOLEAN); |
|
| 101 | } |
|
| 102 | ||
| 103 | /** |
|
| 104 | * Set auto filter grayscale images flag |
|
| 105 | * |
|
| 106 | * @param bool $autoFilterGrayImages |
|
| 107 | * |
|
| 108 | * @return $this |
|
| 109 | */ |
|
| 110 | public function setAutoFilterGrayImages($autoFilterGrayImages) |
|
| 111 | { |
|
| 112 | $this->setArgument(sprintf('-dAutoFilterGrayImages=%s', $autoFilterGrayImages ? 'true' : 'false')); |
|
| 113 | ||
| 114 | return $this; |
|
| 115 | } |
|
| 116 | ||
| 117 | /** |
|
| 118 | * Whether to downsample gray images |
|
| 119 | * |
|
| 120 | * @return bool |
|
| 121 | */ |
|
| 122 | public function isDownsampleGrayImages() |
|
| 123 | { |
|
| 124 | $value = $this->getArgumentValue('-dDownsampleGrayImages'); |
|
| 125 | if (null === $value) { |
|
| 126 | return false; |
|
| 127 | } |
|
| 128 | ||
| 129 | return filter_var($value, FILTER_VALIDATE_BOOLEAN); |
|
| 130 | } |
|
| 131 | ||
| 132 | /** |
|
| 133 | * Set downsample gray images flag |
|
| 134 | * |
|
| 135 | * @param bool $downsampleGrayImages |
|
| 136 | * |
|
| 137 | * @return $this |
|
| 138 | */ |
|
| 139 | public function setDownsampleGrayImages($downsampleGrayImages) |
|
| 140 | { |
|
| 141 | $this->setArgument(sprintf('-dDownsampleGrayImages=%s', $downsampleGrayImages ? 'true' : 'false')); |
|
| 142 | ||
| 143 | return $this; |
|
| 144 | } |
|
| 145 | ||
| 146 | /** |
|
| 147 | * Whether to encode grayscale images |
|
| 148 | * |
|
| 149 | * @return bool |
|
| 150 | */ |
|
| 151 | public function isEncodeGrayImages() |
|
| 152 | { |
|
| 153 | $value = $this->getArgumentValue('-dEncodeGrayImages'); |
|
| 154 | if (null === $value) { |
|
| 155 | return true; |
|
| 156 | } |
|
| 157 | ||
| 158 | return filter_var($value, FILTER_VALIDATE_BOOLEAN); |
|
| 159 | } |
|
| 160 | ||
| 161 | /** |
|
| 162 | * Set encode grayscale images flag |
|
| 163 | * |
|
| 164 | * @param bool $encodeGrayImages |
|
| 165 | * |
|
| 166 | * @return $this |
|
| 167 | */ |
|
| 168 | public function setEncodeGrayImages($encodeGrayImages) |
|
| 169 | { |
|
| 170 | $this->setArgument(sprintf('-dEncodeGrayImages=%s', $encodeGrayImages ? 'true' : 'false')); |
|
| 171 | ||
| 172 | return $this; |
|
| 173 | } |
|
| 174 | ||
| 175 | /** |
|
| 176 | * Get gray image depth |
|
| 177 | * |
|
| 178 | * @return int |
|
| 179 | */ |
|
| 180 | public function getGrayImageDepth() |
|
| 181 | { |
|
| 182 | $value = $this->getArgumentValue('-dGrayImageDepth'); |
|
| 183 | if (null === $value) { |
|
| 184 | return -1; |
|
| 185 | } |
|
| 186 | ||
| 187 | return intval($value); |
|
| 188 | } |
|
| 189 | ||
| 190 | /** |
|
| 191 | * Set gray image depth |
|
| 192 | * |
|
| 193 | * @param int $grayImageDepth |
|
| 194 | * |
|
| 195 | * @return $this |
|
| 196 | */ |
|
| 197 | public function setGrayImageDepth($grayImageDepth) |
|
| 198 | { |
|
| 199 | $this->setArgument(sprintf('-dGrayImageDepth=%s', $grayImageDepth)); |
|
| 200 | ||
| 201 | return $this; |
|
| 202 | } |
|
| 203 | ||
| 204 | /** |
|
| 205 | * Get gray image downsample threshold |
|
| 206 | * |
|
| 207 | * @return float |
|
| 208 | */ |
|
| 209 | public function getGrayImageDownsampleThreshold() |
|
| 210 | { |
|
| 211 | $value = $this->getArgumentValue('-dGrayImageDownsampleThreshold'); |
|
| 212 | if (null === $value) { |
|
| 213 | return 1.5; |
|
| 214 | } |
|
| 215 | ||
| 216 | return floatval($value); |
|
| 217 | } |
|
| 218 | ||
| 219 | /** |
|
| 220 | * Set gray image downsample threshold |
|
| 221 | * |
|
| 222 | * @param float $grayImageDownsampleThreshold |
|
| 223 | * |
|
| 224 | * @return $this |
|
| 225 | */ |
|
| 226 | public function setGrayImageDownsampleThreshold($grayImageDownsampleThreshold) |
|
| 227 | { |
|
| 228 | $this->setArgument(sprintf('-dGrayImageDownsampleThreshold=%s', $grayImageDownsampleThreshold)); |
|
| 229 | ||
| 230 | return $this; |
|
| 231 | } |
|
| 232 | ||
| 233 | /** |
|
| 234 | * Get gray image downsample type |
|
| 235 | * |
|
| 236 | * @return string |
|
| 237 | */ |
|
| 238 | public function getGrayImageDownsampleType() |
|
| 239 | { |
|
| 240 | $value = $this->getArgumentValue('-dGrayImageDownsampleType'); |
|
| 241 | if (null === $value) { |
|
| 242 | return DistillerParametersInterface::IMAGE_DOWNSAMPLE_TYPE_SUBSAMPLE; |
|
| 243 | } |
|
| 244 | ||
| 245 | return substr($value, 1); |
|
| 246 | } |
|
| 247 | ||
| 248 | /** |
|
| 249 | * Set gray image downsample type |
|
| 250 | * |
|
| 251 | * @param string $grayImageDownsampleType |
|
| 252 | * |
|
| 253 | * @throws \InvalidArgumentException |
|
| 254 | * |
|
| 255 | * @return $this |
|
| 256 | */ |
|
| 257 | public function setGrayImageDownsampleType($grayImageDownsampleType) |
|
| 258 | { |
|
| 259 | if (!in_array($grayImageDownsampleType, static::$grayImageDownsampleTypeValues)) { |
|
| 260 | throw new \InvalidArgumentException('Invalid grayscale image downsample type argument'); |
|
| 261 | } |
|
| 262 | ||
| 263 | $this->setArgument(sprintf('-dGrayImageDownsampleType=/%s', $grayImageDownsampleType)); |
|
| 264 | ||
| 265 | return $this; |
|
| 266 | } |
|
| 267 | ||
| 268 | /** |
|
| 269 | * Get gray image filter |
|
| 270 | * |
|
| 271 | * @return string |
|
| 272 | */ |
|
| 273 | public function getGrayImageFilter() |
|
| 274 | { |
|
| 275 | $value = $this->getArgumentValue('-dGrayImageFilter'); |
|
| 276 | if (null === $value) { |
|
| 277 | return DistillerParametersInterface::IMAGE_FILTER_DCT_ENCODE; |
|
| 278 | } |
|
| 279 | ||
| 280 | return substr($value, 1); |
|
| 281 | } |
|
| 282 | ||
| 283 | /** |
|
| 284 | * Set gray image filter |
|
| 285 | * |
|
| 286 | * @param string $grayImageFilter |
|
| 287 | * |
|
| 288 | * @throws \InvalidArgumentException |
|
| 289 | * |
|
| 290 | * @return $this |
|
| 291 | */ |
|
| 292 | public function setGrayImageFilter($grayImageFilter) |
|
| 293 | { |
|
| 294 | if (!in_array($grayImageFilter, static::$grayImageDownsampleTypeValues)) { |
|
| 295 | throw new \InvalidArgumentException('Invalid grayscale image filter argument'); |
|
| 296 | } |
|
| 297 | ||
| 298 | $this->setArgument(sprintf('-dGrayImageFilter=/%s', $grayImageFilter)); |
|
| 299 | ||
| 300 | return $this; |
|
| 301 | } |
|
| 302 | ||
| 303 | /** |
|
| 304 | * Get gray image resolution |
|
| 305 | * |
|
| 306 | * @return int |
|
| 307 | */ |
|
| 308 | public function getGrayImageResolution() |
|
| 309 | { |
|
| 310 | $value = $this->getArgumentValue('-dGrayImageResolution'); |
|
| 311 | if (null === $value) { |
|
| 312 | return 72; |
|
| 313 | } |
|
| 314 | ||
| 315 | return intval($value); |
|
| 316 | } |
|
| 317 | ||
| 318 | /** |
|
| 319 | * Set gray image resolution |
|
| 320 | * |
|
| 321 | * @param int $grayImageResolution |
|
| 322 | * |
|
| 323 | * @return $this |
|
| 324 | */ |
|
| 325 | public function setGrayImageResolution($grayImageResolution) |
|
| 326 | { |
|
| 327 | $this->setArgument(sprintf('-dGrayImageResolution=%s', $grayImageResolution)); |
|
| 328 | ||
| 329 | return $this; |
|
| 330 | } |
|
| 331 | } |
|
| 332 | ||