2 images (1920x1080) not loading on Android

Bug report

I added 2 images (1920px width each) to a note.
On desktop everything is fine but it does not load on android.

I see the text “Loading image…” but nothing happens and the app becomes unresponsive. After a while I can use the app again but can’t choose another note. It always stays in the list view as the viewer crashed. I have to force quit the app to see a note again but images are still not loading.

Info

  • Platform: Android
  • Platform version: 10
  • App Version: current PlayStore version

Reproduce

  • add big images to a note (copy paste)
  • try opening it on android

Thanks in advance. I really love inkdrop so far.

Hi Marco,

Thank you for the report.
It looks like your android phone is lack of memory.
Does it work with smaller images?
The app needs to encode an image to base-64 which takes larger memory than the image itself so it’s kind of memory-inefficient because it is built with React Native.
I’ll fix it if I found any workaround but I’m afraid that it’s hard to avoid at the moment.

Hi Takuya,

thank you for the response and in advance for looking into this.

As a photographer I hoped that I can put some images in a note as a reference (for developing a photo series for example).

All the best

It works fine btw when I insert big images via the phone. When I do this on desktop the android version hangs.

Could you answer my question?

Does it work with smaller images?

I need to know if it is a memory capacity issue.

It works, yes.
I inserted two small images on desktop and I was able to view them fairly quickly on mobile.

I just removed the account from my phone and re-added it (so I’m sure the cache is clear - clear cache via Android preferences didn’t do it).

The first time I would see the note with the big images.
Then I clicked on view-mode (eye-icon) and it displayed another note, not the current one with the big images that I selected.
Then I went back to the list-view and I couldn’t view the note with the big images again.

After this I wasn’t able to view any other note and the text “Please select a note or create” appears when I select a note.

Thank you for the answer.
So, it is a memory capacity issue.
The editor and preview crashes when you opened a note with the big images.
I don’t know which model of Android phone you use but I’m afraid that I can’t help you with this issue since it depends on your device.
The main reason is as I answered above.

It is a Pixel 3a with 4GB of RAM. I’m note sure if it’s a RAM issue as I have more that 1GB free.

Image data:

  1. 279,8 kB (1920x1278) JPG (inkdrop://file:fXBfsGYbm)
  2. 392,4 kB (1920x1309) JPG (inkdrop://file:1ao8k_Fu5)

I hope this helps. I could send you the images if you think it’s worth debugging.

It sounds strange that it happens on Pixel 3a which has sufficient RAM.
Okay, I’ll look into it.
I’m currently working on the new version of the mobile app, involving fundamental changes right now.
Once I’ve finished this work, I’ll try to reproduce it on my Android phone!

1 Like

Just to let you know:
I haven’t had the issue for a while now. Perhaps it was something about the file format. Sadly I can’t remember with what application I saved the problematic JPG files.
When it happens again I’ll let you know here.

Thanks.
I have reproduced it several times with my note with some large screenshots on my iPhone XS.
The UI freezes and I can’t open another note.
Inkdrop v5 is about to be released. I’ll work on it after that!

1 Like

A quick update:

I suspect a reason why the app becomes unresponsive is that the app takes too long time to decrypt images as the decryption process is performed in JavaScriptCore which is not performant or memory efficient.
I guess we need it to be performed in native code to avoid this bottleneck.
It’d be a big challenge though, worth trying it.

Memo:

1 Like

Good news!

1 Like

Thank you for the reminder. This indeed looks impressive - I’m super looking forward to the new Android version :pray::smiling_face_with_three_hearts:

1 Like

Successfully integrated it with the app and it works great.
A 4MB PNG image (3000 × 1688) is displayed without hung up on Android and iOS!

But there is one more thing that can improve the performance further: Native caching.
Because passing images in base64 through SQLite -> RN -> WebView is sooooooo slow.
Images need to be cached in fs and loaded directly from WebView.
I’ll try it.

1 Like

Wouldn’t this also increase the data storage by nearly 2x? It’s probably still a good compromise to make, CPU time vs storage.
Perhaps there could be an option for image/attachment caching?

No, it wouldn’t increase the local storage usage.
I’m planning to just store images to local storage as files instead of to SQLite database, so they can be loaded directly from WebView via file URI.

Ah okay thanks for the clarification :+1:

v4.1.0 beta is out!
Can you please test it?

https://forum.inkdrop.app/t/mobile-v4-1-0-beta-testing/2358

Cheers