diff options
Diffstat (limited to 'server/helpers/image-utils.ts')
-rw-r--r-- | server/helpers/image-utils.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/server/helpers/image-utils.ts b/server/helpers/image-utils.ts index b174ae436..28d8fff4c 100644 --- a/server/helpers/image-utils.ts +++ b/server/helpers/image-utils.ts | |||
@@ -80,6 +80,8 @@ async function autoResize (options: { | |||
80 | const sourceIsPortrait = sourceImage.getWidth() < sourceImage.getHeight() | 80 | const sourceIsPortrait = sourceImage.getWidth() < sourceImage.getHeight() |
81 | const destIsPortraitOrSquare = newSize.width <= newSize.height | 81 | const destIsPortraitOrSquare = newSize.width <= newSize.height |
82 | 82 | ||
83 | removeExif(sourceImage) | ||
84 | |||
83 | if (sourceIsPortrait && !destIsPortraitOrSquare) { | 85 | if (sourceIsPortrait && !destIsPortraitOrSquare) { |
84 | const baseImage = sourceImage.cloneQuiet().cover(newSize.width, newSize.height) | 86 | const baseImage = sourceImage.cloneQuiet().cover(newSize.width, newSize.height) |
85 | .color([ { apply: 'shade', params: [ 50 ] } ]) | 87 | .color([ { apply: 'shade', params: [ 50 ] } ]) |
@@ -106,6 +108,7 @@ function skipProcessing (options: { | |||
106 | const { sourceImage, newSize, imageBytes, inputExt, outputExt } = options | 108 | const { sourceImage, newSize, imageBytes, inputExt, outputExt } = options |
107 | const { width, height } = newSize | 109 | const { width, height } = newSize |
108 | 110 | ||
111 | if (hasExif(sourceImage)) return false | ||
109 | if (sourceImage.getWidth() > width || sourceImage.getHeight() > height) return false | 112 | if (sourceImage.getWidth() > width || sourceImage.getHeight() > height) return false |
110 | if (inputExt !== outputExt) return false | 113 | if (inputExt !== outputExt) return false |
111 | 114 | ||
@@ -116,3 +119,11 @@ function skipProcessing (options: { | |||
116 | 119 | ||
117 | return imageBytes <= 15 * kB | 120 | return imageBytes <= 15 * kB |
118 | } | 121 | } |
122 | |||
123 | function hasExif (image: Jimp) { | ||
124 | return !!(image.bitmap as any).exifBuffer | ||
125 | } | ||
126 | |||
127 | function removeExif (image: Jimp) { | ||
128 | (image.bitmap as any).exifBuffer = null | ||
129 | } | ||