You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m trying to resize images to be presented in retina resolution. When I run the following code, the resulting image is blurry, and I need to double the desired size in order to get a sharp image.
What's going on here? If "points" doesn't mean 2x on Apple LCD displays and 3x on OLEDs, what the heck does it mean?
let calculatedSize = CGSize(width: 400, height: 400)
LazyImage(request: ImageRequest(
url: embed.thumbnail,
processors: [
.resize(
size: CGSize(
width: calculatedSize.width, // * 2 to get sharp image
height: calculatedSize.height // ^ same
),
unit: .points,
contentMode: .aspectFit,
crop: true
)
]
)) { state in
if let retrievedImage = state.image {
ZStack {
retrievedImage
.resizable()
.aspectRatio(contentMode: .fit)
.frame(
maxWidth: calculatedSize.width,
maxHeight: calculatedSize.height
)
}
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I’m trying to resize images to be presented in retina resolution. When I run the following code, the resulting image is blurry, and I need to double the desired size in order to get a sharp image.
What's going on here? If "points" doesn't mean 2x on Apple LCD displays and 3x on OLEDs, what the heck does it mean?
Beta Was this translation helpful? Give feedback.
All reactions