Skip to content

decodeFile returns null Bitmap #70

Description

@mdicosimo

Hello there,
I'm trying to decode a TIF downloaded from the internet and stored to local File.
No exception.
I tried to step into decodeFile and saw options structure correctly filled (width, height, compression type, ...), but the returned bitmap is null.

I just have the notice about "16KB Alignment": could it be the issue?

Thank you.

// Create a temporary file because most TIFF decoders work better with FileDescriptors or Paths
File tempFile = File.createTempFile("radar_temp", ".tif", main.getApplicationContext().getCacheDir());
FileOutputStream out = new FileOutputStream(tempFile);
byte[] buffer = new byte[1024];
int read;
while ((read = input.read(buffer)) != -1) {
    out.write(buffer, 0, read);
}
out.close();

// Use the library to decode
Bitmap myBitmap = TiffBitmapFactory.decodeFile(tempFile);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions