Crazy-Marvin / MetadataRemover

Android App to remove images' metadata
https://crazymarvin.com/metadata-remover/
Apache License 2.0
128 stars 16 forks source link

Enormous apk size increase (9MB -> 150MB) #105

Open ColorfulRhino opened 2 months ago

ColorfulRhino commented 2 months ago

Something is wrong with the latest apk. This has also been talked about here https://github.com/Crazy-Marvin/MetadataRemover/issues/34#issuecomment-2231929176.

Size comparison: v2.0.2: 9.29 MB v2.0.3: 151 MB

More than 15x increase (!). Something's wrong, maybe a debug build was accidentally published or some recent commit added some unneccessarily large library?

CrazyMarvin commented 2 months ago

We recently added the ability to remove metadata from some documents and videos that need some bigger dependencies. Do you see any way to make the builds smaller, @Rashxz?

Rashxz commented 2 months ago

Yes, the increase is comming from the ffmpeg library, Ill see how to reduce the binary size.

ColorfulRhino commented 2 months ago

Thanks for clearing that up! I'm sure there is some way. In my opinion (!) it's totally not worth it for one or two features to have a >1500% size increase.

Rashxz commented 2 months ago

I manage to build a new binary, new size per ABI is roughly 30 MB, universal APK is 40MB.

ColorfulRhino commented 1 month ago

I manage to build a new binary, new size per ABI is roughly 30 MB, universal APK is 40MB.

That's an improvement 👍 Still quite an increase and too big for Izzy's repo, but well done regardless.

TPS commented 1 month ago

Yes, the increase is comming from the ffmpeg library, Ill see how to reduce the binary size.

I manage to build a new binary, new size per ABI is roughly 30 MB, universal APK is 40MB.

That's an improvement 👍 Still quite an increase and too big for Izzy's repo, but well done regardless.

Is it possible to get the same coverage by using using a different library, e.g., exiftool? On my termux, that's ¼ the installation size of ffmpeg, but has a perl dependency, so might come out even?

Rashxz commented 1 month ago

Yes, the increase is comming from the ffmpeg library, Ill see how to reduce the binary size.

I manage to build a new binary, new size per ABI is roughly 30 MB, universal APK is 40MB.

That's an improvement 👍 Still quite an increase and too big for Izzy's repo, but well done regardless.

Is it possible to get the same coverage by using using a different library, e.g., exiftool? On my termux, that's ¼ the installation size of ffmpeg, but has a perl dependency, so might come out even?

The size its not comming only from ffmpeg, but also from the apache-poi library. It indeed could be a reeplacement as it supports a wide range of formats, but it wont help reducing the app size.

Someone mentioned a already made port for android in this issue and that one weights about 40MB, so our current solution is still even / maybe lighter,

TPS commented 1 month ago

@Rashxz The thing about ffmpeg (oh, did you see #117?) is that it's bit overkill for this project, since we don't need >90% of its capabilities here, & ffmpeg-kit doesn't seem to allow for modular import of just the needed sections, so that's just frustrating bloat.

TPS commented 1 month ago

@Rashxz Wait, maybe 1 can decrease that bloat.… Did you see https://github.com/arthenica/ffmpeg-kit/wiki/How-to-Decrease-Binary-Size?

Rashxz commented 1 month ago

@Rashxz Wait, maybe 1 can decrease that bloat.… Did you see https://github.com/arthenica/ffmpeg-kit/wiki/How-to-Decrease-Binary-Size?

Captura de pantalla 2024-08-07 a la(s) 9 34 58 a  m

Yes, I build a new binary with everything stripped. As you can see in the Image, ffmpeg takes 6.9MB of the total size. The rest is coming from all the other dependencies, being the biggest ones apache poi (for libre office) and iText (for pdf).

I will take a look on the dependencies to see if theres room for improvement.

TPS commented 1 month ago

Yes, I build a new binary with everything stripped. As you can see in the Image, ffmpeg takes 6.9MB of the total size. The rest is coming from all the other dependencies, being the biggest ones apache poi (for libre office) and iText (for pdf).

@Rashxz I'm certain there's cheaper avenues to take for these. For pdf, may I suggest qpdf or cpdf as alternatives? I'll research for an alt for office docs, as well.

TPS commented 1 month ago

Yes, I build a new binary with everything stripped. As you can see in the Image, ffmpeg takes 6.9MB of the total size. The rest is coming from all the other dependencies, being the biggest ones apache poi (for libre office) and iText (for pdf).

I'll research for an alt for office docs, as well.

@Rashxz I wonder if a separate dedicated utility is actually needed for LO? Per https://superuser.com/questions/1195338/what-metadata-does-a-libreoffice-file-contain-and-how-to-remove-it, it's matter of "just" deleting 1 file & 2 lines out of another out of the doc (as LO docs are actually zip archives of a certain structure).

Rashxz commented 1 month ago

Yes, I build a new binary with everything stripped. As you can see in the Image, ffmpeg takes 6.9MB of the total size. The rest is coming from all the other dependencies, being the biggest ones apache poi (for libre office) and iText (for pdf).

@Rashxz I'm certain there's cheaper avenues to take for these. For pdf, may I suggest qpdf or cpdf as alternatives? I'll research for an alt for office docs, as well.

Thanks

Rashxz commented 1 month ago

Yes, I build a new binary with everything stripped. As you can see in the Image, ffmpeg takes 6.9MB of the total size. The rest is coming from all the other dependencies, being the biggest ones apache poi (for libre office) and iText (for pdf).

I'll research for an alt for office docs, as well.

@Rashxz I wonder if a separate dedicated utility is actually needed for LO? Per https://superuser.com/questions/1195338/what-metadata-does-a-libreoffice-file-contain-and-how-to-remove-it, it's matter of "just" deleting 1 file & 2 lines out of another out of the doc (as LO docs are actually zip archives of a certain structure).

Sorry, I did not specify it well in my previous comment, that library is not just for LO but also for Microsoft office docs.

TPS commented 3 weeks ago

@Rashxz How did https://github.com/Crazy-Marvin/MetadataRemover/commit/6928c9e100fd96e332f2e88ea0ee897d2fe0913f effect APK/installed size?

Rashxz commented 3 weeks ago

@Rashxz How did 6928c9e effect APK/installed size?

I think its a ~2MB increase

TPS commented 3 weeks ago

IIUC, https://github.com/Crazy-Marvin/MetadataRemover/issues/104#issuecomment-2270767530 notes all this is blocked from landing in F-droid, so no way to see these improvements for such users.