A library to take picture easy, transform your data in different format and save photos in your device


alt tag

A Magic library to take photos and select pictures in Android. In a simple way and if you need it also save the pictures in device, and facial recognition, get the real uri path or the photo or obtain the private information of the picture.
Android Arsenal Codacy Badge License

Get it on Google Play



Buy me a Coffee (Donate)

How to Start

Photo Features and permissions

Footer Docs

Features MagicalCamera.

  • Take picture with camera device.

  • Select pictures in gallery device (read in devices).

  • Write the pictures that you taken in device, in your own directory.

  • Return the path of your photo in device. (This issue is solved for @arthursz)

  • RealTime Permissions Magical camera offers a simple integration of realtime permissions. (This functionallity is created by @cutiko)

  • Working in android 6.0 (We have a class to request the user permission).

  • Create yours standards of name of pictures, or use our standard, like "photoname_YYYYmmddHHmmss"

  • Posibility of shown the private info photography, like latitude, longitude, ISO or others with Exif Class.

  • Posibility of rotate picture when it's required.

  • Select the quality of the photo with a percentage, when 1 is the worst and 100 is the better.

  • Obtain the LandMark and return a bitmap with a facial recognition that you need.

  • Return the BitmapPhoto if you need to save this in internal DB of your application.

  • Convert your bitmap in array bytes or string64, if you need to send by Json or XML.

  • Type of photo formats: PNG, JPEG and WEBP.

Other Features

  • A library completely OpenSource.
  • Use best practice in POO
  • Minimun SDK 14+ API.
  • Support library
  • Compile with Gradle
  • License Under Apache 2.0
  • The easiest possible integration
  • Integrate in less than 5 minutes
  • Quick and simple API
  • A good Internal Documentation



Getting Started

Download Sources

use git (sourcetree or others) Remember Download the example for understand better the process

git clone https://github.com/fabian7593/MagicalCamera.git

Download from Here

Another type download by Bintray from Download


Add dependecies

If you need to take photo or select picture, this is your solution. This library give a magical solution for take a picture,write and red in device, return your uri real path and obtain yhe private info of the photo and facial recognition, you only need to download this and integrate this in your project, maybe downloading it or import in your gradle, like this.

repositories {

dependencies {
    compile 'com.frosquivel:magicalcamera:6.0.0'

If you have any problem with this dependence, because the library override any styles, colors or others, please change the last line for this code:

 compile('com.frosquivel:magicalcamera:[email protected]') {
        transitive = false;

How To use

Import library

You need to import the library

import com.frosquivel.magicalcamera.MagicalCamera;
import com.frosquivel.magicalcamera.Functionallities.PermissionGranted;

//and maybe you need in some ocations
import com.frosquivel.magicalcamera.Objects.MagicalCameraObject;

Extends Application Class

You need to extends MagicalCamera application

public class MyApplicationClass extends MagicalCameraApplication {
    public void onCreate() {
    protected void attachBaseContext(Context base) {

On manifest, change the name, for the name of your Application class, like this:


Permissions on real time

With the MagicalPermissions class you can ask for permissions in a Activity or in an Fragment. This class will take care of validating the device API level, what permissions the user haven't granted yet, ask for thoose permissions, deliver the result and together with MagicalCamera will take the photo or select it from the gallery.

Requesting permissions on real time to the user is a 2 part process. First permissions most be requested, then the result is delivered. So you need a field variable to later call it again on the permissions result:

private MagicalPermissions magicalPermissions;

MagicalPermissions constructor accept two params, the first is the Activity or Fragment and the second is a String array of the permissions you need String[]. MagicalPermissions use the Activity or Fragment to later deliver the result of the permission, and the array to ask for thoose permissions.

magicalPermissions = new MagicalPermissions(this, permissions);

Inside MagicalPermissions it will be solved if the API level of the device requiere to ask permissions or not. If permissions must be asked to the user then MagicalPermissions will validate which permissions are already granted and only asked for the needed. This is why is very important you only ask for the permissions you need, taking the photo or selecting it will only happen if every permission you have asked is granted.

  • By example, if you only need to take the photo then:
String[] permissions = new String[] {
magicalPermissions = new MagicalPermissions(this, permissions);
  • MagicalCamera take care of saving the photo commonly you will need:
String[] permissions = new String[] {
magicalPermissions = new MagicalPermissions(this, permissions);
  • Or maybe you want to use more potential of MagicalCamera and also ask for location related info, then you need:
String[] permissions = new String[] {
magicalPermissions = new MagicalPermissions(this, permissions);

You can also ask for other permissions in other places of your app, even unrelated to MagicalCamera using MagicalPermissions separatedly. So if getting location information is not requiered for the photo, but is a plus, you should consider separating thoose permissions from the absolutely needed to your feature. MagicalPermissions use a Runnable to do whatever you want after checking the permissions. When is used along with MagicalCamera you don't have to be aware of that, is automatic, but in this case we are considering asking for other permissions:

String[] location = new String[] {
locationPermissions = new MagicalPermissions(this, location);

Runnable runnable = new Runnable() {
    public void run() {
        //TODO location permissions are granted code here your feature
        Toast.makeText(context, "Thanks for granting location permissions", Toast.LENGTH_LONG).show();

Then the second part of the process come into play: receiving the permissions result. You have to always override the onRequestPermissionsResult method in the Activity or Fragment. Inside of it, call your instance of MagicalPermissions and give it the result to the permissionResult() method (this is why must be a field). The permissionResult() method is a Map<String, Boolean> in case you need to know what happened and do something about it:

public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    Map<String, Boolean> map = magicalPermissions.permissionResult(requestCode, permissions, grantResults);
    for (String permission : map.keySet()) {
        Log.d("PERMISSIONS", permission + " was: " + map.get(permission));
    //Following the example you could also
    //locationPermissions(requestCode, permissions, grantResults);


Declare variable to resize photo

( with pixels percentage ) You need to declare and constant or a simple int variable for the quality of the photo, while greater be, greater be the quality, and otherwise, worst be the quality, like this

//The pixel percentage is declare like an percentage of 100, if your value is 50, the photo will have the middle quality of your camera. 
// this value could be only 1 to 100.

Instance Class MagicalCamera


You need to instance the MagicalCamera Class, like this: The fisrt param is the current Activity, and the second the resize percentage photo, and the third param is the Permission Granted

 MagicalCamera magicalCamera = new MagicalCamera(this,RESIZE_PHOTO_PIXELS_PERCENTAGE, magicalPermissions);

Activities Methods

You need to call the methods for take or select pictures in activities that this form:

//take photo

//select picture

Fragments Methods

You need to call these methods for take or select pictures in fragments:

//take photo
 //select picture
magicalCamera.selectedFragmentPicture(FragmentSample.this, "My Header Example");

As you can see MagicalCamera is working together MagicalPermissions so you don't need to pass a `Runnable` the camera or photo selection will be triggered once permissions are solved.

Override the event onActivityResult

Remember, you need to override the method onActivityResult in your activity or fragment like this

    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        magicalCamera.resultPhoto(requestCode, resultCode, data);
        //this is for rotate picture in this method
        //magicalCamera.resultPhoto(requestCode, resultCode, data, MagicalCamera.ORIENTATION_ROTATE_180);
        //with this form you obtain the bitmap (in this example set this bitmap in image view)
        //if you need save your bitmap in device use this method and return the path if you need this
        //You need to send, the bitmap picture, the photo name, the directory name, the picture type, and autoincrement photo name if           //you need this send true, else you have the posibility or realize your standard name for your pictures.
        String path = magicalCamera.savePhotoInMemoryDevice(magicalCamera.getPhoto(),"myPhotoName","myDirectoryName", MagicalCamera.JPEG, true);

       if(path != null){
           Toast.makeText(MainActivity.this, "The photo is save in device, please check this path: " + path, Toast.LENGTH_SHORT).show();
           Toast.makeText(MainActivity.this, "Sorry your photo dont write in devide, please contact with [email protected] and say this error", Toast.LENGTH_SHORT).show();

Get Uri path

You only could use


Save Photo in Memory Devices

This method save your bitmap in internal memory device or if the internal memory is full this library save in sdcard (if you have anything) This method have a lot of params that you can need to use the library:

  • Bitmap: This is the bitmap that you need to save in memory device.
  • PhotoName: The name of the photo
  • DirectoryName: The name of directory that you need to save the image
  • Format: the format of the photo, maybe png, jpeg or webp. Depends of that you need.
  • AutoIncrementNameByDate: This variable save the photo with the photo name and the current date and hour. (Only if is true).

For example: myTestMagicalCameraPhoto_20160520131344 -> This is the year 2016, month 5, day 20, hour 13, minute 13 and second 44.

The method:

 public String savePhotoInMemoryDevice(Bitmap bitmap, String photoName, String directoryName,
 Bitmap.CompressFormat format, boolean autoIncrementNameByDate)


 String path = magicalCamera.savePhotoInMemoryDevice(magicalCamera.getPhoto(), "myTestPhotoName", MagicalCamera.JPEG, true);

Types of Formats for save photos

You have any type of formats for save the pictures and the bitmaps. You can use, the static variables of the library MagicalCamera.

 Bitmap.CompressFormat jpeg = MagicalCamera.JPEG;
 Bitmap.CompressFormat png = MagicalCamera.PNG;
 Bitmap.CompressFormat webp = MagicalCamera.WEBP;

Resize photo in real time

You can resize the photo in any moment with this:


Conversion Methods

The library have any methods to convert the bitmap in other formats that you need. All of this methods are public statics, I mean that you dont have to instance the library for usage this. You need to call the class * ConvertSimpleImage * And the respective params.

  • bitmapToBytes: Convert the bitmap to array bytes, only need the bitmap param and the compress format, return array bytes.
  • bytesToBitmap: Convert the array bytes to bitmap, only need the array bytes in param, return bitmap.
  • bytesToStringBase64: Convert the array bytes to String base 64, only need the array bytes format in param, return String.
  • stringBase64ToBytes: Convert string to array bytes, only need the String in param, return array bytes.


  //convert the bitmap to bytes
  byte[] bytesArray =  ConvertSimpleImage.bitmapToBytes(magicalCamera.getPhoto(), MagicalCamera.PNG);
   //convert the bytes to string 64, with this form is easly to send by web service or store data in DB
   String imageBase64 = ConvertSimpleImage.bytesToStringBase64(bytesArray);

   //if you need to revert the process
   byte[] anotherArrayBytes = ConvertSimpleImage.stringBase64ToBytes(imageBase64);

  //again deserialize the image
  Bitmap myImageAgain = ConvertSimpleImage.bytesToBitmap(anotherArrayBytes);

Rotate picture

You have the posibility of rotate picture because some devices have the camera in landscape, and the picture is shown upside down. If you need to rotate image use in event onActivityResult the method with the last param:

  magicalCamera.resultPhoto(requestCode, resultCode, data, MagicalCamera.ORIENTATION_ROTATE_180);

or if you rotate manually in another part of code use method:

//rotate any image
Bitmap myImage = magicalCamera.rotatePicture(magicalCamera.getPhoto(),  MagicalCamera.ORIENTATION_ROTATE_90);

//rotate the getPhoto in magicalCamera Object
Bitmap myImage = magicalCamera.rotatePicture(MagicalCamera.ORIENTATION_ROTATE_NORMAL);

You have this posibillities of rotate image:


Facial Recognition:

This is a method to return your bitmap (magicalCamera.getPhoto()) like another bitmap with a square draws arround the face of the photo, with the posibillity of modify the color and the stroke of the square. And this is not all, you have the posibility of call the List of the photo with facial recognitions, for save data of all faces, for example the distance between eyes, the nose position and mounth position, all of this is important information for facials recognitions.

You need to write for example:

if(magicalCamera != null){
    if(magicalCamera.getPhoto() != null){
         //this comment line is the strok 5 and color red for default
         //you can the posibility of send the square color and the respective stroke
         imageView.setImageBitmap(magicalCamera.faceDetector(50, Color.GREEN));

         List<Landmark> listMark = magicalCamera.getListLandMarkPhoto();
                 "Your image is null, please select or take one",
             "Please initialized magical camera, maybe in static context for use in all activity",

The photo and bitmap converted is like to:

alt tag

Private information Photo:

This method show you the private information photo if the photo is saved in device or not... For view all information the device need to activate GPS locations (and maybe internet), else not show all information :(.

You need to write this code for example:

 //verify if the bitmap of image have data
 if(magicalCamera.getPhoto()!=null) {
   //verify if this photo is save in device, and if has private information to show and return true if have information, or false is not
   if(magicalCamera.initImageInformation()) {

         StringBuilder builderInformation = new StringBuilder();

         if (notNullNotFill(magicalCamera.getPrivateInformation().getLatitude() + ""))
             builderInformation.append("Latitude: " + magicalCamera.getPrivateInformation().getLatitude() + "\n");

         if (notNullNotFill(magicalCamera.getPrivateInformation().getLatitudeReference()))
             builderInformation.append("Latitude Reference: " + magicalCamera.getPrivateInformation().getLatitudeReference() + "\n");

         if (notNullNotFill(magicalCamera.getPrivateInformation().getLongitude() + ""))
             builderInformation.append("Longitude: " + magicalCamera.getPrivateInformation().getLongitude() + "\n");

         if (notNullNotFill(magicalCamera.getPrivateInformation().getLongitudeReference()))
             builderInformation.append("Longitude Reference: " + magicalCamera.getPrivateInformation().getLongitudeReference() + "\n");

         if (notNullNotFill(magicalCamera.getPrivateInformation().getDateTimeTakePhoto()))
             builderInformation.append("Date time to photo: " + magicalCamera.getPrivateInformation().getDateTimeTakePhoto() + "\n");

         if (notNullNotFill(magicalCamera.getPrivateInformation().getDateStamp()))
             builderInformation.append("Date stamp to photo: " + magicalCamera.getPrivateInformation().getDateStamp() + "\n");

         if (notNullNotFill(magicalCamera.getPrivateInformation().getIso()))
             builderInformation.append("ISO: " + magicalCamera.getPrivateInformation().getIso() + "\n");

         if (notNullNotFill(magicalCamera.getPrivateInformation().getOrientation()))
             builderInformation.append("Orientation photo: " + magicalCamera.getPrivateInformation().getOrientation() + "\n");

         if (notNullNotFill(magicalCamera.getPrivateInformation().getImageLength()))
             builderInformation.append("Image lenght: " + magicalCamera.getPrivateInformation().getImageLength() + "\n");

         if (notNullNotFill(magicalCamera.getPrivateInformation().getImageWidth()))
             builderInformation.append("Image Width: " + magicalCamera.getPrivateInformation().getImageWidth() + "\n");

         if (notNullNotFill(magicalCamera.getPrivateInformation().getModelDevice()))
             builderInformation.append("Model Device: " + magicalCamera.getPrivateInformation().getModelDevice() + "\n");

         if (notNullNotFill(magicalCamera.getPrivateInformation().getMakeCompany()))
             builderInformation.append("Make company: " + magicalCamera.getPrivateInformation().getMakeCompany() + "\n");

         new MaterialDialog.Builder(MainActivity.this)
                 .title("See photo information")
           "This photo donte have ifnormation, remember, for obtain the info you need to save the picture in device before",
           "You dont have data to show because the photo is null (your photo isn't in memory device)",
 and the method that I use in the example is for validate not null or empty
    private boolean notNullNotFill(String validate){
        if(validate != null){
                return true;
                return false;
            return false;

See the example of this infomartion return:

alt tag

Footer Document

Internal documentation

All the code has a internal documentation for more explanation of this example.

Preview of Example

alt tag

Application that use MagicalCamera


Feel free to contact me to add yours apps to this list.


MagicalCamera was created to make Android Devoloper's life easy. If you have any feedback please let us know in the issues by creating an issue with this format:

  • Write what your feedback is about and add the next "tag" including the square brackets [FEEDBACK]

Suggestions about how to improve the library or new features are welcome. Thanks for choosing us.

Credits and Contributors


Fabián Rosales - Frosquivel Developer :

A magical camera author, I do the take camera, select photo, rotate picture, convert bitmap, facial recognition, save picture, get information and others...

alt tag alt tag alt tag alt tag


Erick Navarro

MagicalCamera Contributor (Cutiko) Erick Add a best usage of google play library, and he develop the better usage of permissions, and an excellent code refactor for permission class and other components.

Arthur Zettler

MagicalCamera Contributor (arthursz) Arthur create the return path of the image saved like a String.

Contributors are welcome

The goal for MagicalCamera is to allow Android Developers care about what is important, feautures not getting worry about something that should be trivial such as taking a picture. We look forward to make this a great library to make image capture process simple and painless. There are amny features and other issues waiting. If you would like to contribute please reach to us, or maybe be bold! Getting a surprise pull request is very gratifying.


You can see the video explication here (in spanish) This video is for MagicalCamera version 1.0



Copyright 2016 Fabian Rosales

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

  • Photos are always in landscape

    Photos are always in landscape


    I have being using this since a while now, and it is great. However, today I notice, always photos are stored in landscape orientation, what if the user take a photo in portrait orientation.

    I thought this could be just my phone, so I try it with another, and same problem in both (Samsung galaxy note neo 3 and Sony xperia).

    opened by cutiko 16
  • NullPointerException name

    NullPointerException name

    java.lang.RuntimeException: Unable to resume activity {com.frosquivel.examplemagicalcamera/com.frosquivel.examplemagicalcamera.MainActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=null} to activity {com.frosquivel.examplemagicalcamera/com.frosquivel.examplemagicalcamera.MainActivity}: java.lang.NullPointerException: name == null at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2790) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2819) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2254) at android.app.ActivityThread.access$800(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5052) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=null} to activity {com.frosquivel.examplemagicalcamera/com.frosquivel.examplemagicalcamera.MainActivity}: java.lang.NullPointerException: name == null at android.app.ActivityThread.deliverResults(ActivityThread.java:3367) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2777) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2819)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2254)  at android.app.ActivityThread.access$800(ActivityThread.java:141)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5052)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)  at dalvik.system.NativeStart.main(Native Method)  Caused by: java.lang.NullPointerException: name == null at java.io.File.<init>(File.java:150) at java.io.File.<init>(File.java:124) at com.frosquivel.magicalcamera.MagicalCamera.getPhotoFileUri(MagicalCamera.java:349) at com.frosquivel.magicalcamera.MagicalCamera.onTakePhotoResult(MagicalCamera.java:229) at com.frosquivel.magicalcamera.MagicalCamera.resultPhoto(MagicalCamera.java:191) at com.frosquivel.examplemagicalcamera.MainActivity.onActivityResult(MainActivity.java:81) at android.app.Activity.dispatchActivityResult(Activity.java:5437) at android.app.ActivityThread.deliverResults(ActivityThread.java:3363) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2777) 

    opened by avew 11
  • Crashing on takePhoto

    Crashing on takePhoto

    Device - Xiomi A1 OS - 8.0.0

    App is crashing when we take photo and magicalCamera.resultPhoto(requestCode, resultCode, data); is crashing in onActivityResult.

    I have also tested your application on Google Play, that is also crashing.

    Logs: Process: com.test.imagesearch, PID: 24454 java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=null} to activity {com.test.imagesearch/com.test.imagesearch.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference at android.app.ActivityThread.deliverResults(ActivityThread.java:4348) at android.app.ActivityThread.handleSendResult(ActivityThread.java:4391) at android.app.ActivityThread.-wrap19(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:172) at android.app.ActivityThread.main(ActivityThread.java:6637) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference at com.frosquivel.magicalcamera.Utilities.PictureUtils.resizePhoto(PictureUtils.java:43) at com.frosquivel.magicalcamera.Functionallities.ActionPicture.onTakePhotoResult(ActionPicture.java:184) at com.frosquivel.magicalcamera.Functionallities.ActionPicture.resultPhoto(ActionPicture.java:203) at com.frosquivel.magicalcamera.MagicalCamera.resultPhoto(MagicalCamera.java:206) at com.test.imagesearch.MainActivity.onActivityResult(MainActivity.java:123) at android.app.Activity.dispatchActivityResult(Activity.java:7235) at android.app.ActivityThread.deliverResults(ActivityThread.java:4344)

    opened by vishalgupta1987 10
  • How to get initial path of the photo

    How to get initial path of the photo

    if the image was already saved to on the device, how can i get the path. I want to use this to get the exif info

    question new functionallity 
    opened by buelersandra 8
  • NullPointerException - Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference

    NullPointerException - Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference

    Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference at com.frosquivel.magicalcamera.Utilities.PictureUtils.resizePhoto(PictureUtils.java:43) at com.frosquivel.magicalcamera.Functionallities.ActionPicture.onTakePhotoResult(ActionPicture.java:184) at com.frosquivel.magicalcamera.Functionallities.ActionPicture.resultPhoto(ActionPicture.java:203) at com.frosquivel.magicalcamera.MagicalCamera.resultPhoto(MagicalCamera.java:206) at com.example.luis.myapplication.views.SubsectorActivity.onActivityResult(SubsectorActivity.java:1451) at android.app.Activity.dispatchActivityResult(Activity.java:6442) at android.app.ActivityThread.deliverResults(ActivityThread.java:3716) at android.app.ActivityThread.handleSendResult(ActivityThread.java:3763) at android.app.ActivityThread.-wrap16(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1403) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5443) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

    opened by sebamena 6
  • Problem with Android >= 24

    Problem with Android >= 24

    Hi, I think this lib is not supporting Android 24 properly. I am getting this error:

    android.os.FileUriExposedException: file:///storage/emulated/0/... exposed

    Reference: http://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed


    opened by jaesga 5
  • Path Gallery

    Path Gallery

    my gallery path is set wrong. can you help me?

    opened by jomblocoder 4
  • Rotate picture

    Rotate picture

    Yes I can rotate the picture. But according to what? When I take a picture with the phone vertically the photo is turned 90 ° in the ImageView, have you planned something on this subject?

    opened by Simston 4
  • NoClassDefFoundError when using imageView.setImageBitmap(magicalCamera.faceDetector())

    NoClassDefFoundError when using imageView.setImageBitmap(magicalCamera.faceDetector())

                                                                       Process: com.facedetection, PID: 25183
                                                                       java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/vision/face/FaceDetector$Builder;
                                                                           at com.frosquivel.magicalcamera.Functionallities.FaceRecognition.faceDetection(FaceRecognition.java:68)
                                                                           at com.frosquivel.magicalcamera.Functionallities.FaceRecognition.faceDetector(FaceRecognition.java:51)
                                                                           at com.frosquivel.magicalcamera.MagicalCamera.faceDetector(MagicalCamera.java:109)
                                                                           at com.facedetection.MagicBaby.onActivityResult(MagicBaby.java:73)
                                                                           at android.app.Activity.dispatchActivityResult(Activity.java:7137)
                                                                           at android.app.ActivityThread.deliverResults(ActivityThread.java:4921)
                                                                           at android.app.ActivityThread.handleSendResult(ActivityThread.java:4968)
                                                                           at android.app.ActivityThread.access$1600(ActivityThread.java:222)
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1849)
                                                                           at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                           at android.os.Looper.loop(Looper.java:158)
                                                                           at android.app.ActivityThread.main(ActivityThread.java:7229)
                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
                                                                        Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.vision.face.FaceDetector$Builder" on path: DexPathList[[zip file "/data/app/com.facedetection-1/base.apk"],nativeLibraryDirectories=[/data/app/com.facedetection-1/lib/arm64, /vendor/lib64, /system/lib64]]
                                                                           at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                           at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                                           at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                                           at com.frosquivel.magicalcamera.Functionallities.FaceRecognition.faceDetection(FaceRecognition.java:68) 
                                                                           at com.frosquivel.magicalcamera.Functionallities.FaceRecognition.faceDetector(FaceRecognition.java:51) 
                                                                           at com.frosquivel.magicalcamera.MagicalCamera.faceDetector(MagicalCamera.java:109) 
                                                                           at com.facedetection.MagicBaby.onActivityResult(MagicBaby.java:73) 
                                                                           at android.app.Activity.dispatchActivityResult(Activity.java:7137) 
                                                                           at android.app.ActivityThread.deliverResults(ActivityThread.java:4921) 
                                                                           at android.app.ActivityThread.handleSendResult(ActivityThread.java:4968) 
                                                                           at android.app.ActivityThread.access$1600(ActivityThread.java:222) 
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1849) 
                                                                           at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                           at android.os.Looper.loop(Looper.java:158) 
                                                                           at android.app.ActivityThread.main(ActivityThread.java:7229) 
                                                                           at java.lang.reflect.Method.invoke(Native Method) 
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                                                                       	Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.vision.face.FaceDetector$Builder
                                                                           at java.lang.Class.classForName(Native Method)
                                                                           at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                                                                           at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                                                                           at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                                                                           		... 16 more
                                                                        Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

    I have all permissions in manifest and requested all permissions at runtime.

    opened by riadrifai22 3
  • FileUriExposedException in Fragment

    FileUriExposedException in Fragment

    Hi, i am get this error : android.os.FileUriExposedException: file://com.frosquivel.magicalcamera.Provider.PhotoProvider/storage/emulated/0/Android/data/com.example.smr.scc1/files/Pictures/MagicalCamera/MagicalCamera exposed beyond app through ClipData.Item.getUri()

    I am using 'com.frosquivel:magicalcamera:6.0.0' I really apreciate your help...

    opened by camposvo 3
  • No Image on Android 11

    No Image on Android 11

    When taking picture using magical camera 6.0.0 on Android 11 no photo is returned in activity result.

    opened by ndakhtar 1
  • java.lang.NullPointerException in Fragment

    java.lang.NullPointerException in Fragment

    Hi guys! Tell me how to catch the result of a photo in a Fragment? I have a parent activity for navigation drawer menu and several fragments, but a photo is required in one fragment

    opened by saserg 0


    i haven't encountered the error when i am using the library in two projects. I can only install either one application on testing devices and got this error when i try to install second application to same testing device. Both applications install successfully if i remove this library on either one project. How do i solve this?

    opened by allanckto 1
  • Android 9.0 pie Api=28

    Android 9.0 pie Api=28

    i add MagicalCamera to my project and it doesnt work, is there any problem whit api 28? or is there something extra to do?

    opened by eloidramsess 1
  • Camera Selfie (Front Camera)

    Camera Selfie (Front Camera)

    Please Add Functionality for remove icon to change Camera by Selfie. I need use only the Back Camera.

    opened by Animesa 0
  • Permission Problem After Marshmallow

    Permission Problem After Marshmallow

    Hello, Thanks for great library. I got a problem about permissions.. If user has no permissions on Camera and Storage, MagicalCamera itself cannot handle it and "return mapPermissions?.get(permission)!!" returns NullPointerException. (Tried on both Java and Kotlin)

     private fun isActivePermission(permission: String): Boolean {
            // This map is return in method onRequestPermissionsResult for view what permissions are actives
            if (android.os.Build.VERSION.SDK_INT >= 23) {
                if (mapPermissions != null) {
                    if (mapPermissions!!.size > 0) {
                        // Obtain the code of camera permissions
                         return mapPermissions?.get(permission)!!
                    } else {
                        return true
                } else {
                    return true
            } else {
                return true

    I could not solve the problem, please help me. Thank you

    bug question 
    opened by WrathChaos 3
  • Add more Functionalities

    Add more Functionalities

    Please add basic edit functionalities like brightness, contrast, flip and croping

    new functionallity 
    opened by billy9222 2
  • Duplicate pictures

    Duplicate pictures

    Hi. All works when I take a picture and I save it in my custom directory. The problem is that it also save it in DCIM directory with full quality. I'm testing in Android 7.0. Thanks.

    opened by jeronimosodero 1
Fabian Rosales (Frosquivel Developer)
Mobile and Web API Developer. ♚ Family, Love, Freedom, Music, Software Programming, Arduino, Design, Photography♚
Fabian Rosales (Frosquivel Developer)
Wrapper around the android Camera class that simplifies its usage

EasyCamera Wrapper around the android Camera class that simplifies its usage (read more about the process) Usage: // the surface where the preview wil

Bozhidar Bozhanov 646 Aug 4, 2021
📸 A library that allows you to capture images secretly, in background without alerting users.

HiddenCamera A library that allows you to capture images secretly, in background without alerting users. Gradle Dependency Add the dependency to your

Cotta & Cush Limited 105 Sep 18, 2021
Quick photo and video camera with a flash, customizable resolution and no ads.

Simple Camera A camera with flash, zoom and no ads. The camera is usable for both photo taking and video recording. You can switch between front and r

Simple Mobile Tools 562 Oct 12, 2021
Pix is a Whatsapp image picker replica. with this, you can integrate an image picker just like WhatsApp.

Pix (WhatsApp Style Image and Video Picker) Pix is a WhatsApp image picker replica. with this you can integrate a image picker just like WhatsApp. Upc

Akshay sharma 630 Oct 9, 2021
📸 Use Android camera to take pictures and videos, based on `camera2` api.

Camera Use Android camera to take pictures and videos, based on camera2 api. Features Auto filled CameraView for previewing Support both image capture

Hong Duan 112 Aug 15, 2021
Powerful custom Android Camera with granular control over the video quality and filesize, restricting recordings to landscape only.

LandscapeVideoCamera Highly flexible Android Camera which offers granular control over the video quality and filesize, while restricting recordings to

Jeroen Mols 1.2k Oct 8, 2021
Android library to choose image from gallery or camera with option to compress result image

ImagePicker Android library to choose image from gallery or camera with option to compress result image. Download Add this to your project's build.gra

Mayank Nagwanshi 64 Oct 20, 2021
Instagram like Image Picker for Android

ImagePicker A simple Instagram like library to select images from the gallery and camera. Screenshot Usage For full example, please refer to the sampl

Akvelon 17 Oct 6, 2021
Measures human heart rate using camera and flash light.

Heart-Rate-Ometer Introduction Measures human heart rate using camera and flash light. How-it-works https://github.com/phishman3579/android-heart-rate

Jan Rabe 78 Oct 6, 2021
A new camera app for GrapheneOS based on the modern CameraX library.

This is the new GrapheneOS Camera app based on Android's modern CameraX library. It's currently in the alpha phase and isn't yet included in GrapheneO

GrapheneOS 33 Oct 16, 2021
Image Picker library for Android

Ronnie-Image-Picker Asks for Camera and storage permission and return uri of the images taken or picked from the gallery. Min Api Level: 16 Build Syst

Ronnie Otieno 18 Sep 24, 2021
Android application to preview, record (MediaRecorder), and fetch each image from both front and rear cameras simultaneously

DuoCamera ?? Overview Android application to preview, record (MediaRecorder) and fetch each image from both front and rear cameras simultaneously. The

Igor Lashkov 1 Oct 17, 2021