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
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:
- How to display Album Art in an app?Best solution by Stack Overflow
- Is it really difficult to get into the art Institute of California-San Diego?Best solution by Yahoo! Answers
- I need to get some soap art.Best solution by smallnotebook.org
- Where can I get some cool art prints?Best solution by barewalls.com
- How to get into Commercial Art as a career?Best solution by ChaCha
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.