Image Rotates and zooms while editing - ios

I am using a library called SnapSliderFilters to apply filters to an image. I need the filters to be applied exactly the way it is presented in the library's example.
When I implemented the code exactly as directed on an image captured with a custom camera, sliding sideways, while applying the image filter, it also causes the image to rotate by 90 degrees and the image to zoom.
In other case, when I select an image from gallery, that is of exact dimension as the screen, it works perfectly fine.
So, I think I have found the cause to be image size but I don't know where to begin.
Here is how it displays:

Related

Need help in position images when view going back into place using

Hey everyone I've been stuck on this issue for the past few days. It's pretty hard to describe so I uploaded a video for it on a GitHub repository:
https://github.com/DJSimonSays93/PresentationController
It involves custom view controller transitions using present and the delegates UIViewControllerTransitioningDelegate and UIViewControllerAnimatedTransitioning
The "problem" is straightforward, now let me see if I can describe it in words.
You've got two image views showing, say, the basil image: the one in the scroll view, and the full-screen one when you present. They are both set at Aspect Fill. But the aspect ratio itself is different for these two image views. Therefore, in order to be displayed in Aspect Fill in a different image view, the image shifts in the way it is shown.
The reason you find this upsetting at the end of the dismiss is that you don't notice it happening at the start of the present, but if you slow down your video (you can turn on Slow Animations on the simulator, it will help), you can see it there too:
When you tap an image in the scroll view, there is a jump as the image changes its display for the new image view, and then the image view grows to its true size as the transform is removed (animated).
When you tap the full screen image, the transform is applied (animated) and then there is a jump as the image view is taken away to reveal the old image view that was behind it.
If you make both image view Scale To Fill, that won't happen. Of course then there is a distortion of the image, but it is the same distortion so that the image appears to grow and shrink smoothly right the way through. Try it and you will at least be satisfied by the sense of what I'm saying.
(See https://www.apeth.com/stretch.gif.)
If you don't want to do that, then you will have a lot more work to do; you will need to figure out how to actually compensate for the difference in aspect ratio by changing the aspect ratio of the image to match. Or, you could make the goal size of the fullscreen image view match the aspect ratio of the small image view (and part of it will just end up offscreen).
The point is, you cannot display the same image using Aspect Fill in image view with different aspect ratios and expect the image to appear the same way in both. Either the image needs to be different (to compensate) or the aspect ratios need to be the same.

Export portrait video to square but with scaleAspectFit ratio

In my app I allow users to record videos in portrait mode. I use that within the app and that is fine. However, I'm implementing a feature to share the videos on Instagram, where videos must be square.
Cropping the video to square, lets say the center part, is an option, however as the user doesn't consider this when taking the video, it usually turns out bad.
Therefore, I'd like to export the video square, but with an aspect fit ratio and with two bars left and right. Optimally, is there any way to define the colors of the background (either by code or by UIImage).
The closest thing I was able to find is this, however I can't make much use of it as I'm unclear on how to set up the transformation.
Example (red box just to mark the image bounds):
Beside trying to add black bars and re-render the video you can use the cameraOverlayView property of UIImagePickerController.
So you can create a view that has 2 black bars in OR you can create a view that has a square frame over the camera view so they know to frame it in there because it will share to instagram.

iOS swipe filters over static image

I'm looking for a way to swipe image filters over top of a still image.
Mainly the base image stays in place, and the filters slide in over top when you swipe left or right.
Right now I have a base UIImageView and a Collection View over top of it which in theory would hold the filters (texture and gradient images).
I've read that UIImageViews and UIViews can't be live composited on top of each other, and that you must make the image before displaying it. So I can pre-make the image beforehand in code, then can I wipe-reveal the filter image to get the same effect? Using masks?
Code examples are nice, but a high level description on how to approach this would be helpful.
The app Spark has this functionality for videos, I'm looking to do something similar for photos.
So I can pre-make the image beforehand in code, then can I wipe-reveal the filter image to get the same effect? Using masks?
Yes, but no need for a mask. Pre-make the filtered image and put it in an image view. Let's say this filtered effect is to be swiped in from the left. Then make the image view's content mode be Left, and put it at the left of the real image, with width zero. As the swipe happens, animate the width of the image view to the width of the image. This will cause the filtered image to be revealed from the left side.

Camera/photo gallery in corona sdk

In my application,I used PhotoLibrary,it get photo, small part of that image.In full image it picks only the corner part.i searched over the net it tells,it checks the device size and image size return device size image only.then how it is possible to bring whole image.
Many photos are larger than the screen size. Corona can only show what's on screen. You have two choices, put the larger image inside of a widget.newScrollVew() so you scroll around and see the larger image, or scale the image down until it fits on the screen.

UIImagePickerController that allowsEditing incorrectly crops the image leaving a black bar across the top

I'm using UIImagePickerController in a popover on the iPad to take a picture with the front camera. I set allowsEditing to YES and get the awesome built in "Move and Scale" view after taking the picture. The crop rectangle in this view measures 320x267 on the screen despite the fact that the image is cropped to a 320x320 square (http://dl.dropbox.com/u/2246698/moveAndScale.png). If i accept the image as is without resizing or moving it, there is a ~25px high black bar across the top as if the crop rectangle has been positioned too high on the image (http://dl.dropbox.com/u/2246698/cropped.png). In fact, if i get that crop rectangle from the media info dictionary (via UIImagePickerControllerCropRect) it shows that the y origin of the crop rectangle is at -39. This seems broken that the image would be incorrectly cropped by default and usually when it seems broken it's because i did it wrong. Has anyone ever seen this or know of some setting to twiddle that will be good for my crops?
Many thanks.
I see the exact same behavior. It MUST be a bug, but if it is, I don't know why more people aren't complaining about it. Another problem with it is that you can't move the picture to the edges to crop to include that part--it always slides back to the middle.
If you zoom it, then you can move it, but you can never move it far enough to be able to include the left or right edges.
The thing is next to useless.

Resources