RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.82k stars 405 forks source link

Include width & height of the taken image in PhotoResult #137

Closed vanniktech closed 6 years ago

vanniktech commented 6 years ago

It would be cool if the width & height of the image would be available in the PhotoResult class.

Diolor commented 6 years ago

I see. How about the EXIF data of the photo? Are they empty?

vanniktech commented 6 years ago

Can I get them easily without creating anything?

Diolor commented 6 years ago

If you use BitmapPhoto you can use the [bitmap's api method](https://developer.android.com/reference/android/graphics/Bitmap.html#getWidth()). If from a file check step 3 with ExifInterface.TAG_IMAGE_WIDTH.

Will that work?

dmitry-zaitsev commented 6 years ago

Alternatively you can use BitmapFactory to just decode the bounds of the image (specifically by using BitmapFactory.Options.inJustDecodeBounds. This is a pretty fast operation.

We will consider adding the image size to the result in the future.

vanniktech commented 6 years ago

The Exif solution would probably work. However that step, parsing the file could be saved altogether since Fotoapparat should know the size of the image already when the picture was taken. Also it feels like a good fit for the PhotoResult class.

Diolor commented 6 years ago

FA doesn't know the dimens.

Agree that Photo could also have the dimens

vanniktech commented 6 years ago

Oh okay didn't know that. Then I'll leave it up to you whether you want to add support for that or not. Using ExifInterface on the consuming side is fine too.