Closed sixten closed 11 years ago
Ugh; it never occurred to me that folks might want to scale an image to larger than its original size.
Hrm, on the develop branch, this code:
NSURL *imageURL = [NSURL URLWithString:@"https://f.cloud.github.com/assets/7528/927805/5243561a-ffa7-11e2-9776-63733fe2673f.png"];
OGScaledImage *image = [[OGScaledImage alloc] initWithURL:imageURL size:CGSizeMake(120.f, 56.f) cornerRadius:0.f method:OGImageProcessingScale_AspectFit key:nil placeholderImage:[UIImage imageNamed:@"placeholder"]];
Gives me this scaled image, which appears correct:
The upscaling is not by choice, really, there just isn't absolute control over what images folks might upload.
The other possibility that occurred to me yesterday: that the artifacts are data leaking from one of the other images. Maybe a buffer that's being allocated, but not cleared before being drawn into, so the old data appears in the parts with alpha transparency? Especially because the garbage in my "after" image greatly resembles this (being loaded by the app at around the same time):
Sure, I make no judgments about design constraints!
Try the issue-25 branch (https://github.com/origamilabs/OGImage/tree/issue-25) -- we weren't filling vImage_Buffer
s with transparent pixels before processing into them.
So far, so good. Thanks!
Took the library for a test drive in one of our apps, in a collection view that's loading images from the web and displaying thumbnails. In some cases, however, I'm seeing artifacts in the scaled result.
Here's an example of one such image in its original form:
And the result:
Two possibilities spring to mind: 1. that the original is actually smaller than the target size (120 x 56 pt) and is getting scaled up, and 2. that this image has a transparent background. Or maybe it's something else altogether?