Sharp UILabel after zooming image - ios

I don't know what to ask exactly. I put a text on an UIImage (with aspect fit content) and save it to album. If saved image is same size as aspect content mode then "text" seems OK. But after zooming in that image, text on that image gets blurred. I want it to be sharp also. Is it possible to do that?
Is it possible to increase pixel count per point? Or What should I do?
Edit: I think I need to increase font size without increasing frame. Is it possible to increase font size (for example from 20 to 50) without changing label's frame size.
Thank you.

If the image is saved as a bitmap, there's not much you can do. The best suggestion I can make is to render it at larger than the target size and save THAT to the photo album. Normally it will be scaled smaller, which looks good. Then when the user zooms in, the text will still be sharp because you will be revealing text rendered at the larger size.
The down-side, of course, is file size and memory footprint. Larger images take more storage, more memory, and more CPU horsepower to display.
I seriously doubt if the iOS photo album supports any vector formats (PDF, illustrator, etc.) If they did that would be another possibility, but like I said, probably not.

Related

iOS - Size of Image vs. Size of ImageView

just want to see if I'm on the right track here is understanding the performance trade-offs of placing various image sizes into image views.
If I have a large image, will the image load faster if I place it in a correspondingly large imageView versus placing it in a smaller imageView?
No, the loading time depends on the file, and if the image is large, and its file Size is large, it will load slower than a small images on the same image View.
To make it clear, image view doesn't affect loading performance, image size (File size) does affect performance.
Answering you r question first, size of image is not directly proportional to imageview i.e. regardless of your imageview size, you image will take time based on the size of image.
Now, if you have a task in which you need to show user images & on click you need to share that image, you need to maintain 2 copies for showing take resized copy & while sharing pick image from original position. In this way, your loading will be fast & while sharing you will be able to share original image itself.

how to load image from camera for specific/variable sizes?

I have a very simple requirement here but I'm looking for a solution for a while. I want to take a profile picture form the camera roll or camera and display it in two different image views (different sizes). I don't want any of these images stretched or miss any part of the image. If I use aspect to fit, top side of image is cut from smaller image view and some parts missing on the bigger image view. If I set it as scale to fit, it will get stretched!
I'm not sure how some mobile apps work. Do they save different image sizes in their server or they change the size of the image. I saw many posts how to change image size without changing aspect ratio. But I don't think it is possible to avoid stretched effects. I used some of those code to change size of image, it gets stretched all the time.
Is there any way to save the image from camera roll one time with size of 140*200 and one time 160*200? So I can use 140*200 for image views that size. But what if I have different devices and different sizes.

Proportional image size changing without quality decreasing in TImage

I have TImage 800x600 with image 1024x768.
TImage aligns to alClient.
Timage is proportional.
TImage is streched.
When I resize the form, the image resizes too, but it's quality makes lower and the visible text labels on the Image shrinks, makes unreadable, or even after load big image into small TImage, I have the same problem.
How I can resolve that? How resize image in TImage with quality where text still readable in any normal size?(e.g. 1024x768 resized to 500x400, and text still readable in it).
You cannot hope to resize raster graphics and maintain high quality text. Text is rendered to a specific resolution. Any resampling will destroy the quality of the text. The only way to maintain high quality text through a resize operation is to re-render the text at the new resolution. One way to achieve that is to use a vector graphics format rather than raster. Another way is to be able to re-create the text on the fly.
TImage resizing is not perfect. I prefer to keep the original image in the memory, and to use, say, bicubic resizing when needed (or bilinear for shrinkink). Once you resized the image just draw it to the TImage on the form.
Always keep the original image in the memory, and discard the resized one from the memory once you draw it.

how to display image (containing text) with a good quality

I’m new in iOS and trying to make simple app with hierarchy of viewcontrollers. In the last one I wanna display scrollable image (which can also be zoomed at least x1,5), containing some small black and white picture and a piece of text. Initially I planned to make vector image, convert it to .jpg and use UIScrollView for displaying. But I found out that .jpg ( approx. 150 KB) didn’t provide a good quality for displaying text. As I have to use a lot of images I don’t want to increase image size. What is worse I also want it look good on retina display.
Can you recommend a way how to display image, containing text, with enough quality?
I mean that I don’t want the user see the separate pixels of letters in the text. Just like when you read text in your e-mail in iOS. Image size should be as small as possible. Planning physical size of image – approx. 5 cm x 15 cm.
Any help much appreciated
Thanks
To get good edges you would need to use png not jpg, which will make the image sizes much larger. I have a better suggestion, more code but better solution.
The answer is to not put the text into the image, but to draw it over it in real time.
You would:
associate text at some coordinate in the image (say a CGRect) with the image
create a uiimageview subclass that in the drawRect routine, after calling super, draws the text using the NSString categories on UIKit (which let you draw into a context)
To get going on this please create a small one vc project and get the subclass working there, then back port it to your primary project.

When iOS shrinks an image, does it clip/pixelate it?

I have 2 relatively small pngs that will be images inside UIButtons.
Once our app is finished, we might want to resize the buttons and make them smaller.
Now, we can easily do this by resizing the button frame; the system automatically re-sizes the images smaller.
Would the system's autoresize cause the image to look ugly after shrinking the image? (i.e., would it clip pixels and make it look less smooth than if I were to shrink it in a photo editor myself?)
Or would it better to make the image the sizes they are intended to be?
It is always best to make the images of correct size from the beginning. All resize-functions will have negative impact on the end result. If you scale it up to a larger image it will be a big different, but even if you scale it down to a smaller it is usually creating visible noise in the image. Let's say that you have a line of one pixel in your image. scale it down to 90% of the original size, this line will just use 90% of a pixel wide and other parts of the images will influence the colors of the same pixels.

Resources