Nimbus NIToolbarPhotoViewController Image Crisping Effect - ios

I'm using Nimbus to display a photo album with scrubber and zoomable image view. I use network images, and display a thumbnail until the final image is loaded. NIPhotoAlbumScrollView provides the method didLoadPhoto:atIndex:photoSize: to accomplish exactly that.
From the source code comments, the NIPhotoScrollView should support that "image crisping effect" - showing thumbnail and when full-size image is loaded, sharpen the image without loosing the zoom state.
This feature seems broken though. When the thumbnail is loaded, it is displayed in its 1:1 pixel size, which is very small on screen. When the full-size image is loaded, it is also loaded in its 1:1 pixel size (if smaller than the available view size), which makes the image visually jump bigger.
Any idea on how to fix that issue?
Note that I tried both with a full sized image with dimensions bigger or smaller than the size of the NIToolbarPhotoViewController on screen.

you may already be doing this, but one thing to make certain:
where you implement photoAlbumScrollView:photoAtIndex:photoSize:isLoading:originalPhotoDimensions: for protocol NIPhotoAlbumScrollViewDataSource, you must do the following, as mentioned in these comments in the source:
* If you have a thumbnail in memory but not the full-size image yet, then you should return
* the thumbnail, set isLoading to YES, and set photoSize to NIPhotoScrollViewPhotoSizeThumbnail.

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.

AVMutableVideoComposition image overlay low quality

I am creating a feature where a user can record a video of themselves, and superimposed on this video is a view that displays an image and some text. When they are done recording, I am using AVFoundation's composition classes to composite the video and the view (as an image) into one video file, and output this in the next scene in a custom video player. The problem is that while the view's resolution is crystal clear in the record scene, after the composition (and after the AVExportSession completes) the resulting video's overlayed view quality is not clsoe to the actual view quality. I am converting the view to an image, and then setting the contents of an overlay layer as this image's CGImage, which, as I have checked, still has the same quality as the original view. The problem occurs when I apply the composition, and the image becomes blurry. Does anyone have any idea why this might be happening?
If you need to see the code, please feel free to ask! I can also provide screenshots.
Thank you!
It could happen when initiating your UIImage, iOS automatically pick #2x or #3x image source for you corresponding to your device.
Let say you get image size using size property like image.size, it gives you #1x size, and you might reduce your image size from #2x or #3x to #1x, you get a bad quality image output, because JPEG or PNG resize algorithms.

SDWebImage resize image

I am using the SDWebImage library in order to download and cache images. In my application, each user has an avatar which can be displayed in different shapes and sizes (circle, square ...).
Right now i am downloading the image, and when i get it i resize it according to the image view size.
But i think this approach is inefficient and specially when scrolling in a table view.
Is there a different approach (concerning SDWebImage) that allows me to get the image in the desired size without having to resize it my self ?
Thanks.
You can resize image once and store it in a cache (SDImageCache). Then load it from this cache. There is no way to get the image in the desired size without having to resize it yourself, unless such image of desired size exists on the server.

ios: image resize as per screen resolution

I am displaying image thumbnails from urls(which are in json file) into custom cells of a tableview.
The images loaded from url are not showing up properly- they are of a resolution much higher than need and some are of much lower resolution.
How do I manipulate these images so that they are scaled properly as per each screen(retina as well as normal) in iphone?
How do I scale and resize the thumbnail images from url?
Unless you care about other issues like memory or disk usage (for some caching) for the images, you don't have to resize them.
You can use UIViewContentModeScaleAspectFit as contentMode for an UIImageView and just set an image for the image view. It would be sufficient for you.

Resources