Before send the image to the server, I need to make an Image like the picture above. I want the image will always be in the vertical position (portrait), with the aspect ration let say 280:410 , but the user will sometimes pick an image with horizontal position (landscape).
在将图像发送到服务器之前,我需要制作一张如上图所示的图像。我希望图像始终处于垂直位置(纵向),纵横比例为280:410,但用户有时会选择水平位置(横向)的图像。
If the user pick an image in landscape, then I want to make an Image like picture above. I am not sure how to achieve that but I think that I should make an overlapped Images.
如果用户在横向中选择图像,那么我想在上面制作如图像的图像。我不知道如何实现这一点,但我认为我应该制作一个重叠的图像。
I think I should make the blur image first and then combine it to the original image from the user, but I don't know how to process the image, to make the vertical blur as the base image.
我想我应该首先制作模糊图像,然后将其与用户的原始图像相结合,但我不知道如何处理图像,使垂直模糊成为基本图像。
I need to know how to make the base Image, I mean that blurry portrait/vertical image from the landscape image provided by the user. but I don't know how to do that in code :(
我需要知道如何制作基本图像,我的意思是来自用户提供的风景图像的模糊肖像/垂直图像。但我不知道如何在代码中这样做:(
could you please help me in this one ? Many Thanks :)
你可以帮助我吗?非常感谢 :)
1 个解决方案
#1
0
What I would do is:
我会做的是:
-
first layer: a
UIImageView
with your picture in it, with the propertyaspectFill
第一层:带有图片的UIImageView,属性aspectFill
-
second layer: a blur layer with maybe a
UIBlureffectview
or something like that.第二层:一个模糊层,可能有一个UIBlureffectview或类似的东西。
-
third layer: another
UIImageView
in the middle with the same image in it that will just fit to your width and be centered vertically, with the propertyaspectFit
that time.第三层:中间的另一个UIImageView,其中包含相同的图像,适合您的宽度并垂直居中,属性aspectFit为时间。
Note: There must be a better/optimized way, but that one as the advantage to be doable in a storyboard or xib. The code will just take care of loading the image inside the UIImageView
注意:必须有一个更好/更优化的方式,但那个是在故事板或xib中可行的优势。代码将负责在UIImageView中加载图像
#1
0
What I would do is:
我会做的是:
-
first layer: a
UIImageView
with your picture in it, with the propertyaspectFill
第一层:带有图片的UIImageView,属性aspectFill
-
second layer: a blur layer with maybe a
UIBlureffectview
or something like that.第二层:一个模糊层,可能有一个UIBlureffectview或类似的东西。
-
third layer: another
UIImageView
in the middle with the same image in it that will just fit to your width and be centered vertically, with the propertyaspectFit
that time.第三层:中间的另一个UIImageView,其中包含相同的图像,适合您的宽度并垂直居中,属性aspectFit为时间。
Note: There must be a better/optimized way, but that one as the advantage to be doable in a storyboard or xib. The code will just take care of loading the image inside the UIImageView
注意:必须有一个更好/更优化的方式,但那个是在故事板或xib中可行的优势。代码将负责在UIImageView中加载图像