Improve default avatar quality.

pull/1/head
Matthew Chen 7 years ago
parent a602a807f6
commit 4ea6d72008

@ -2,17 +2,15 @@
"images" : [ "images" : [
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "profile-28@1x.png", "filename" : "contact-avatar-1024.png",
"scale" : "1x" "scale" : "1x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "profile-28@2x.png",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "profile-28@3x.png",
"scale" : "3x" "scale" : "3x"
} }
], ],

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

@ -136,9 +136,10 @@ NS_ASSUME_NONNULL_BEGIN
// We don't have a name for this contact, so we can't make an "initials" image. // We don't have a name for this contact, so we can't make an "initials" image.
UIImage *icon = [UIImage imageNamed:@"contact-avatar"]; UIImage *icon = [UIImage imageNamed:@"contact-avatar"];
// The contact-avatar asset is designed for the kStandardAvatarSize. // The contact-avatar asset is designed to be 28pt if the avatar is kStandardAvatarSize.
// Adjust its size to reflect the actual output diameter. // Adjust its size to reflect the actual output diameter.
CGFloat scaling = self.diameter / (CGFloat)kStandardAvatarSize; // We use an oversize 1024px version of the asset to ensure quality results for larger avatars.
CGFloat scaling = (self.diameter / (CGFloat)kStandardAvatarSize) * (28 / 1024.f);
CGSize iconSize = CGSizeScale(icon.size, scaling); CGSize iconSize = CGSizeScale(icon.size, scaling);
image = image =
[OWSAvatarBuilder avatarImageWithIcon:icon iconSize:iconSize backgroundColor:color diameter:self.diameter]; [OWSAvatarBuilder avatarImageWithIcon:icon iconSize:iconSize backgroundColor:color diameter:self.diameter];

Loading…
Cancel
Save