aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/image-utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/image-utils.ts')
-rw-r--r--server/helpers/image-utils.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/server/helpers/image-utils.ts b/server/helpers/image-utils.ts
index 9d0c09051..7d6451db9 100644
--- a/server/helpers/image-utils.ts
+++ b/server/helpers/image-utils.ts
@@ -118,6 +118,8 @@ async function autoResize (options: {
118 const sourceIsPortrait = sourceImage.getWidth() < sourceImage.getHeight() 118 const sourceIsPortrait = sourceImage.getWidth() < sourceImage.getHeight()
119 const destIsPortraitOrSquare = newSize.width <= newSize.height 119 const destIsPortraitOrSquare = newSize.width <= newSize.height
120 120
121 removeExif(sourceImage)
122
121 if (sourceIsPortrait && !destIsPortraitOrSquare) { 123 if (sourceIsPortrait && !destIsPortraitOrSquare) {
122 const baseImage = sourceImage.cloneQuiet().cover(newSize.width, newSize.height) 124 const baseImage = sourceImage.cloneQuiet().cover(newSize.width, newSize.height)
123 .color([ { apply: 'shade', params: [ 50 ] } ]) 125 .color([ { apply: 'shade', params: [ 50 ] } ])
@@ -144,6 +146,7 @@ function skipProcessing (options: {
144 const { sourceImage, newSize, imageBytes, inputExt, outputExt } = options 146 const { sourceImage, newSize, imageBytes, inputExt, outputExt } = options
145 const { width, height } = newSize 147 const { width, height } = newSize
146 148
149 if (hasExif(sourceImage)) return false
147 if (sourceImage.getWidth() > width || sourceImage.getHeight() > height) return false 150 if (sourceImage.getWidth() > width || sourceImage.getHeight() > height) return false
148 if (inputExt !== outputExt) return false 151 if (inputExt !== outputExt) return false
149 152
@@ -154,3 +157,11 @@ function skipProcessing (options: {
154 157
155 return imageBytes <= 15 * kB 158 return imageBytes <= 15 * kB
156} 159}
160
161function hasExif (image: Jimp) {
162 return !!(image.bitmap as any).exifBuffer
163}
164
165function removeExif (image: Jimp) {
166 (image.bitmap as any).exifBuffer = null
167}