question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't load tile image from internal storage

See original GitHub issue

Using TileView 3.0.1, I tried to load tile images from internal storage but it doesn’t seems to work. My initialization code is:

.setSize(4000, 6000)
.setTileSize(256)
.defineZoomLevel(2, "/storage/emulated/0/Android/data/tileview.demo/files/3-%1$d-%2$d.jpg")
.defineZoomLevel(1, "/storage/emulated/0/Android/data/tileview.demo/files/4-%1$d-%2$d.jpg")
.defineZoomLevel(0, "/storage/emulated/0/Android/data/tileview.demo/files/5-%1$d-%2$d.jpg")
.setStreamProvider(new StreamProviderFiles())
.build();

Checking the source code of Tile class, I noticed that an exception was raised in decode() on stream.reset() => java.io.IOException: mark/reset not supported

I managed to avoid this error wrapping the FileInputStream into a BufferedInputStream or resetting the stream using mStreamProvider.getStream(mColumn, mRow, context, mDetail.getData()); again but a new problem appeared.

Tiles are now visible but there is random glitch on my map and I noticed this kind of errors in logcat:

D/skia: libjpeg error 105 <  Ss=0, Se=63, Ah=0, Al=0> from Incomplete image data
D/skia: libjpeg error 116 <Corrupt JPEG data: 6593 extraneous bytes before marker 0xd9> from output_message
D/skia: libjpeg error 51 <JPEG datastream contains no image> from output_message
D/skia: libjpeg error 51 <JPEG datastream contains no image> from setjmp

Using the demo project with my custom images in asset folder works fine so I am sure that my images are fine.

Changing this solve the problem:

public TileRenderExecutor() {
    this(1);   //instead of Runtime.getRuntime().availableProcessors()
}

but it’s obviously not a good solution.

Thanks for your help.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:19 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
moagriuscommented, May 6, 2019

Version 4 is out, including a demo with files in both SD card and internal store

Closing fixed.

1reaction
moagriuscommented, Apr 30, 2019

hm so apparently it’s something today with stream carets for local files. i’m getting “Mark was invalidated”. This was apparently a big thing during the old UIL days with similar stream handling around local files. I’ve got to shut down for now, but I feel like this is a solvable problem, and definitely a bug introduced when moving from Bitmaps to Streams. I hope to have this solved soon, and will keep this thread updated. Off for now

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to load tiles from a large bitmap in Android?
Answer from Romain Guy in Is it possible to chop a bitmap to small pieces without loading ... If the image is stored...
Read more >
Can ArcGIS Desktop load folder of tile images - Esri Community
I have a directory of images which make up a single raster "library". The naming convention contains the information on tile "positioning", ...
Read more >
Why are some of my pictures showing up as blank? - iFixit
Just go to settings>apps>gallery then press the 3 dots on the right top and press uninstall updates, it will tell you that data...
Read more >
I can't show images from the internal storage in the app
I cannot display images located on the internal storage. Try moving it into other folders and nothing. The path I use is: /image.png...
Read more >
Optimize Photoshop performance - Adobe Support
If you experience out-of-RAM or out-of-memory errors in Photoshop, ... image data and choose one of the four available cache tile sizes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found