Skip to content

Commit bcd0802

Browse files
committed
Fix an issue with thumbnails for image responses being too aggressively compressed
1 parent d54cee8 commit bcd0802

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/Pulse/Helpers/ImageProcessor.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ enum Graphics {
3535
return PlatformImage(cgImage: image)
3636
}
3737

38-
static func encode(_ image: PlatformImage) -> Data? {
38+
static func encode(_ image: PlatformImage, compressionQuality: CGFloat = 0.8) -> Data? {
3939
guard let source = image.cgImage else {
4040
return nil
4141
}
@@ -49,7 +49,7 @@ enum Graphics {
4949
return nil
5050
}
5151
let options: NSDictionary = [
52-
kCGImageDestinationLossyCompressionQuality: 0.33
52+
kCGImageDestinationLossyCompressionQuality: compressionQuality
5353
]
5454
CGImageDestinationAddImage(destination, source, options)
5555
CGImageDestinationFinalize(destination)

Sources/Pulse/LoggerStore/LoggerStore.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ extension LoggerStore {
498498
return data
499499
}
500500
guard let thumbnail = Graphics.makeThumbnail(from: data, targetSize: 512),
501-
let data = Graphics.encode(thumbnail) else {
501+
let data = Graphics.encode(thumbnail, compressionQuality: 0.7) else {
502502
return data
503503
}
504504
return data

0 commit comments

Comments
 (0)