Closed MomoSolaris8 closed 1 year ago
options.readTiffDirectory = 1;
Are you sure you have more than one page in your tiff file? If no - just not use this option
Also there is new version 0.9.9.1. plz try it
And firstly, I really thank you that you created the beautiful, useful project !
Question 1: options.readTiffDirectory = 1; Are you sure you have more than one page in your tiff file?
what means page? I really do not know it ? Which option should I use ? Please help me !
Question 2: Yes(in my view ) , I have 10 example .tif Images under storage/emulated/0/Download/ , and I picked only one image, such as Storage/Simulation/0/Download/Response_1.tif, to convert to png.
Question 3: In your README.md
//Convert to PNG
TiffConverter.convertTiffPng("/sdcard/in.tif", "/sdcard/out.png", options, progressListener);
However I cannot find the sdcard in my phone , so i print the uri path using https://gist.github.com/tatocaster/32aad15f6e0c50311626 to get the imagepath. My Image path : Storage/Simulation/0/Download/Response_1.tif Myphone is Samsung SM-A528B
I have previously installed only old version 0.9.9.0 , now installed new version 0.9.9.1. And still I get shutdown!!!
what means page? Tiff files could have many pages. Each page contains some image. Numeration of pages starts from 0. if You not set readTiffDirectory, then page №0 will be used. SO you can just delete this option from your code. What android version do you use? if 10 or greater you shouldn't use file paths, you should use file descriptors. if 9 and below - did you get permission to write to storage?
Description: I got a task to load an image in .tif file format in android studio (really phone)and then do a method of image transformation (python code to handle image transformation, like gabor filter/transformation).
My steps:
Problem: 1.I chose to finish selecting the image from the gallery and the app shutdwon!!!
and I have this logcat error, I don`t really understand this meaning(search Beyka in logcat search) :
2022-11-18 13:02:52.625 32130-32130 DEBUG pid-32130 A #02 pc 000000000001b818 /data/app/~~njWGMcyI4gUAcaf-MlxABg==/com.example.demo8-fENlZr-_q_0NKYWEBNe8Jg==/lib/arm64/libtiffconverter.so (Java_org_beyka_tiffbitmapfactory_TiffConverter_convertTiffPng+112) (BuildId: df448798ff7fc0449147e9e7908310cbf5fdb9fe) ---------------------------- PROCESS ENDED (31712) for package com.example.demo8 ---------------------------- ---------------------------- PROCESS STARTED (32188) for package com.example.demo8 ----------------------------
`import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView;
import android.Manifest; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Bundle; import android.os.FileUtils; import android.os.ParcelFileDescriptor; import android.provider.MediaStore; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView;
import com.chaquo.python.PyObject; import com.chaquo.python.Python; import com.chaquo.python.android.AndroidPlatform;
import org.beyka.tiffbitmapfactory.CompressionScheme; import org.beyka.tiffbitmapfactory.IProgressListener; import org.beyka.tiffbitmapfactory.TiffBitmapFactory; import org.beyka.tiffbitmapfactory.TiffConverter;
import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity">`