Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - What is outputX/outputY and aspectX/aspectY when crop an image from gallery or camera?

I read a lot of posts about cropping an image from gallery or camera, and I know outputX/outputY refers to the size of the output/cropped image. However, nobody ever explained what does aspectX/aspectY do? And what is the unit of outputX/outputY? Is it dp?

Sample code: Modify Android crop intent

like image 301
katie Avatar asked May 27 '15 15:05

katie


2 Answers

aspectX and aspectY are just a proportion, so if you want an 16:9 image putting aspectX = 16 and aspectY = 9 you get the desired ratio.

Good Luck!

like image 127
Jorge Cordero Avatar answered Oct 18 '22 21:10

Jorge Cordero


aspectX and aspectY are the ratio of width and height of the result image, if you need to scale it. width / height = aspectX / aspectY

And I don't think the unit of outputX and outputY are dp. I think its just pixel.

like image 5
user4979208 Avatar answered Oct 18 '22 21:10

user4979208