I am trying to create a photo application but I am having a tough time formatting my photos so that they show clearly.
I have an imageview size 320 * 500, and an image size 3648*2736 px (Which of course I can scale down).
imageView.contentMode=UIViewContentModeScaleAspectFit;
With imageView.contentMode=UIViewContentModeScaleAspectFit; I changed the image size to 700* 525px (IMGA) and one 500 * 325(IMGB).
In this mode
IMGA fills the entire image view but is somehow a little distorted/not crisp
IMGB does not fill the entire image view Top and Bottom but the width is perfect and the image is crisp.
UIViewContentModeScaleAspectFill
With UIViewContentModeScaleAspectFill
the image is made for fit into the uiimageview but again distorted even if the image is scaled down vs being scaled up.
I see many apps with crisp large images . and I am hoping that someone helps me with measuring/ contentmode to get my images better.
Or correct my resizing
P.S I have been looking at this link to try help but I'm still missing my goal.
Difference between UIViewContentModeScaleAspectFit and UIViewContentModeScaleToFill?
Related
I am loading image from a url usig sdwebimage and putting it in a uiimageviww, it working perfectly,but since of all the image size differences the image sometime is a little pit distorted or the ratio from width to height is making it small,note( iam using aspects fit),my question is how to know the best width/height sizes so i can redefine the width and height uiimageview
Images taken with our device camera's are larger than the screen on our iOS device.
Usually when we render an image in iOS i see people setting their rendering size to the size of the main view or their image view.
As shown in this stack overflow response.
Doing so will make the image smaller and lower quality.
If the logic follows.
Would it be possible to render the image with it's full size if I make the image view go beyond the device screen. In other words the image view will be set to the size of the original full sized image.
Will doing this generate a rendered image with the same pixel size of the original image ?
What have I done so far ?
I have tested other image overlaying/editing apps and they seem to reduce the image's pixel size.
I used the methods provided in the link above and they also do the same.
Yes it's definitely possible by embedding a UIImageView in a UIScrollView and using sizeToFit:
imageView.image = image;
[imageView sizeToFit];
scrollView.contentSize = image.size;
You will then be able to pan across the image within the scroll view.
Update: I'll make some crops for the Umbraco's image cropper (Umbraco.ImageCropper) in Umbraco 7.6. The users uploads images over the 4MB (some images are over the 7MB). Now I'll crop resize this images to improve page speed.
I've seen that some of the images are taken in landscape and others in portrait. For a image gallery I'll have the original height and width ratio but with a max width of 500 pixels with a variable height.
I've tried to place the height empty and place to zero but both gives me an error:
I can only make crops with a fixed width and height. Now my questions are:
Could I give the crop a variable height dependent on the original size of the image?
Could I just resize the image to a fixed width?
We have a background image for our app that needs to be full screen for each device we run the app on. Our problem is the background image is tiling on our iPhone 6S+ (Display Zoom off).
I have drawn in red lines to highlight where the tiling is occurring...
We have created 3 background images of the following sizes...
So, designing for 1x (which is the recommended way to go), our base level 1x background image is 320 pixels wide. Our 2x is 640 pixels, and our 3x is 960 pixels.
The problem is the iPhone 6S+ is 1080 pixels wide and according to this chart, you need to start with a 3x image that is 1242 pixels wide. And this is where I am missing how this is supposed to work.
from https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions
With the above chart in mind, it seems you need a separate image for each resolution highlighted with a red square in the above image. Is this correct? And if yes, how do you label each individual image so that at runtime the correct one is picked?
Three images, named as you have them for background.png, are all you need.
Now let's talk about image views. They display their image using a content mode. The key thing is to pick the correct mode. Aspect Fill is what you probably want here, because it will fill the image view without distorting the image.
One procedure, then, is to use a bigger image than what you have, and configure the image view that shows the image to use an appropriate content mode such as Aspect Fill, so that it sizes the image down to fit (or, to save memory, at runtime you can size it down yourself).
The other possibility would be to leave your image as it is, and solve the issue on the Plus machines by telling the image view to size the image up to fit, again possibly by using Aspect Fill. That might or might not look acceptable; you'd have to try it and see what you think.
I have an image view in which I have set image.It works fine if the size of image and image view is almost same. But what if we change the device, Image view is inc in size but the image gets stretched. I am unable to find any way to resize this image such that the image is not affected by the size of image view and at the same time remain centralized also. Also resolution of the image should not be affected.
you can use
[imageView setContentMode:UIViewContentModeScaleAspectFill];
or
[imageView setContentMode:UIViewContentModeScaleAspectFit];
Aspect Fit: Will size your image until the whole image will fit within your UIImageView Box. Thats why you are left with the extra space on top and bottom.
Aspect Fill: Will size your image proportionally until the whole UIImageView is full of your image. So that is why you see clipping of your image. It will actually size it proportionally to make sure there is no blank space left in your imageview.
In a nutshell: Aspect Fit makes sure your whole image is visible proportionally. Aspect Fill will make sure there is no space left in the imageview while sizing your image proportionally.
so it is upon you what you can compromise.
a rendom google image for example.
use this imageViewName.contentMode = UIViewContentModeScaleAspectFit;
as per docs This option is used to scale the content to fit the size of the view by maintaining the aspect ratio