How to get the album art of mp3 file?

Is it possible to get bitmap(Album art) from mp3 file or file inputstream?

  • Is it possible to retrieve bitmap( Album art ) of mp3 file from it's file path or file input stream. Like using BitmapFactory API or some other API.

  • Answer:

    To extract album art from an mp3 file, there is no direct API available in Android as of now. You need to extract it via FFmpeg for the same.

Moses at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

Using the following method you can get the album art uri of an image file. public Uri getArtUriFromMusicFile(File file) { final Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; final String[] cursor_cols = { MediaStore.Audio.Media.ALBUM_ID }; final String where = MediaStore.Audio.Media.IS_MUSIC + "=1 AND " + MediaStore.Audio.Media.DATA + " = '" + file.getAbsolutePath() + "'"; final Cursor cursor = context.getContentResolver().query(uri, cursor_cols, where, null, null); Log.d(TAG, "Cursor count:" + cursor.getCount()); /* * If the cusor count is greater than 0 then parse the data and get the art id. */ if (cursor != null && cursor.getCount() > 0) { cursor.moveToFirst(); Long albumId = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.ALBUM_ID)); Uri sArtworkUri = Uri.parse("content://media/external/audio/albumart"); Uri albumArtUri = ContentUris.withAppendedId(sArtworkUri, albumId); cursor.close(); return albumArtUri; } return Uri.EMPTY; }

Kartheek

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.