Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retina display problem #23

Closed
abiaad opened this issue Jun 25, 2012 · 2 comments
Closed

Retina display problem #23

abiaad opened this issue Jun 25, 2012 · 2 comments

Comments

@abiaad
Copy link

abiaad commented Jun 25, 2012

I'm using ELCImagePickerController for my application. This is great but compared to the original picker controller it seems that the image saved is not retina ready. I compared two images and the one from ELCImagePicker is a bit pixeled ...

Here's the code that is getting the UIImage :

for(ALAsset *asset in _assets) {

        NSMutableDictionary *workingDictionary = [[NSMutableDictionary alloc] init];
        [workingDictionary setObject:[asset valueForProperty:ALAssetPropertyType] forKey:@"UIImagePickerControllerMediaType"];
        [workingDictionary setObject:[UIImage imageWithCGImage:[[asset defaultRepresentation] fullScreenImage]] forKey:@"UIImagePickerControllerOriginalImage"];
        [workingDictionary setObject:[[asset valueForProperty:ALAssetPropertyURLs] valueForKey:[[[asset valueForProperty:ALAssetPropertyURLs] allKeys] objectAtIndex:0]] forKey:@"UIImagePickerControllerReferenceURL"];

        [returnArray addObject:workingDictionary];

        [workingDictionary release];    
    }

Do you know how can I do to correctly render my images (for retina) ? I tried to change - fullScreenImage property to - fullResolutionImage but the result is insanely huge (400 ko to 1 Mo for a photo). Thanks for your help !

@brutella
Copy link

Be sure that when you scale down the image in your code to use the dimension * 2 on retina devices.

Eg.
When you want to show an image in a 40x40 view, you should scale the image down to 80x80 on retina devices and add it to a 40x40 sized image view.

@jvanmetre
Copy link
Contributor

Changing the scale part of the following to [UIScreen mainScreen].scale should fix this.
This is also done in commit: 3894cf2
Change:
UIImage *img = [UIImage imageWithCGImage:imgRef
scale:assetRep.scale
orientation:(UIImageOrientation)assetRep.orientation];

To be:
UIImage *img = [UIImage imageWithCGImage:imgRef
scale:[UIScreen mainScreen].scale
orientation:(UIImageOrientation)assetRep.orientation];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants