noobprogrammer
noobprogrammer

Reputation: 125

How to save a thumbnail to a JPEG file?

I use the Android Camera API to take pictures and edit them. Unfortunately there is no thumbnail in the EXIF header after writing the edited bitmap to the file.

I know I can use ThumbnailUtils to extract a thumbnail from my edited bitmap. But is it possible to save the new thumbnail to the EXIF header of the new file?

ExifInterface allows me to retrieve the thumbnail byte array of the JPEG, but I can't write them to the JPEG, since there's no method or EXIF Tag.

Is it possible without external libs?

Thank you!

Upvotes: 2

Views: 1387

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007399

Is it possible without external libs?

Not really. I mean, you are welcome to write your own EXIF parsing and generating code, if you want to. Usually, "without external libs" is interpreted as "using methods in the Android SDK", and the Android SDK edition of ExifInterface does not support what you seek.

This library is based off of Android's source code and appears to support setting the thumbnail via methods like setCompressedThumbnail() on the library's edition of ExifInterface.

Upvotes: 2

Related Questions