iPhone - save image at higher resolution without pixelating it - iphone

I am using the image picker controller to get an image from the user. After some operations on the image, I want the user to be able to save the image at 1600x1200 px, 1024x1024 px or 640x480 px (something like iFlashReady app).
The last option is the size of image I get in the UIImagePickerControllerDelegate method (when using image from camera roll)
Is there any way we can save the image at these resolutions without pixelating the images?
I tried creating a bitmap context with the width and height I want (CGBitmapContextCreate) and drawing the image there. But the image gets pixelated at 1600x1200.
Thanks

This is non-trivial. Your image just doesn't have enough data. To enlarge it you'll need to resample the image and interpolate between pixels (like photoshop when you resize an image).
Most likely you'll want to use a 3rd party library such as:
http://code.google.com/p/simple-iphone-image-processing/
This performs this and many other image processing functions.

From faint memories of computer vision class from long ago, I think what you do is to blur the image after the up-convert.

Before drawing try adjusting your CGBitmapContext's antialiasing and/or interpolation quality:
CGContextSetShouldAntialias( context, 1 == 1 )
CGContextSetInterpolationQuality( context, kCGInterpolationHigh ) ;
If I remember right, antialiasing is turned off on CGContext by default.

Related

Resize and Crop an image using a single convert() action

I'm currently looking to try and create a simple image uploader application which allows a user to load a picture from their desktop, select a crop area (using jcrop) in a specific aspect ratio, and then have filepicker.io crop to the defined dimensions and resize down appropriately.
The users will be uploading a picture of unknown dimensions, selecting an area that is in 10:13 ratio (width x height) and then filepicker needs to crop their image before resizing it to 100x130px.
Currently I have to perform 2 separate convert actions to crop and resize the image, which takes additional time and seems less efficient than it could be. Is there any way to combine crop and resize into a single action?
To get an idea of what I'm after, I would like this command to return an image 100x130 cropped to my ideal size:
/convert?crop=546,119,412,36&w=100&h=130
You can see a note on their documentation about the topic:
Crop and Resize: we strongly recommend against combining a resize (specifying width or height) with the crop functionality, as it has indeterminant effects depending on whether the crop is applied before or after the image is resized.
Source: https://developers.inkfilepicker.com/docs/web/#inkblob-images
It is possible and easy to do with Uploadcare
Here is an example:
Original image:
https://ucarecdn.com/c35d77e8-4b09-4040-ad36-a5b264f17094/CDN.png
Cropped and resized image, in one operation:
https://ucarecdn.com/c35d77e8-4b09-4040-ad36-a5b264f17094/-/crop/570x460/730,70/-/resize/200x150/Resized_CDN.png

Image viewer without smoothing

How to create an image viewer for iOS which doesn't do image smoothing when zooming? Like the image viewer of Screenshots Journal.
If you have a NSGraphicsContext in which your drawing takes place, you can call [-NSGraphicsContext setShouldAntialias:NO].

UIImagePickerController capture full screen on iphone

I'm using UIImagePickerController class to capture image from camera.
When is captured, I save the picture on disk. After that I use imageWithContentsOfFile method to load this image as background of the main screen.
The problem is that when I load the picture appears 2 white bands on top & bottom of the view.
My question is how can I take a picture with 320X480px of size in order to load it full screen?
Thanks.
--EDIT--
The originalImage when is captured sizes this:
INFO -> Captured Image Size W:480.000000 H:640.000000
How can I get the image directly 320X480px?
Thanks.
Presumably you get white bands because you've got the content mode of the UIImageView you're displaying it in set to UIViewContentModeAspectFit which means resize the image, maintaining aspect so that it you can see the entire image. If you set the content mode to UIViewContentModeAspectFill it'll do what you want.
The reason for this discrepancy is that the aspect ratio of the screen (2:3) is not the same as the aspect ratio of the images that come from the camera (3:4).

Cutting image within an image with Corona SDK

I was wondering if it's possible to cut an image within an image with the Corona SDK using your finger? If it is indeed possible, I'd like to know how. It's for an iphone game. Thanks.
There are two ways you can do this.
One is to replace the image with two halves of the original.
You will need to edit the image, which is cumbersome.
Second is to use bitmap masks as alpha masks.
The masks are grayscale images: white = show, black = hide.
This method won't require you to change the image.
Create two halves of the original image.
Hide half of each image shown here as A & B
using 2 separate alpha masks.
Sample Code from Corona here
This would assume your image would always be sliced in the same way.

resize an to a specific size without losing its quality in iphone

I want to resize an image to a particular width and height without losing its image quality in iphone.
Resize the frame of the image view that contains the image. The image won't change, but it will get smaller. This way you can use the same image for older iPhone screens and Retina Display screens.
If you want to resize the image (so that it takes up less storage space) you'll always lose quality.