Android 图像旋转,导入错误

3

大家好。

我在导入方面遇到了问题。它显示出导入错误,如果我将它们删除,则JpegImageMetadataSanselanImageReadExceptionTiffImageMetadataExifTagConstants无法解析为类型。

我正在使用Android 2.3.3,也尝试过Android 3.2,仍然遇到了同样的问题。以下是导入内容:

import org.apache.sanselan.ImageReadException;
import org.apache.sanselan.Sanselan;
import org.apache.sanselan.formats.jpeg.JpegImageMetadata;
import org.apache.sanselan.formats.tiff.TiffImageMetadata;
import org.apache.sanselan.formats.tiff.constants.ExifTagConstants;

这是代码的另一部分,它显示了错误(如有需要,我可以发布整个代码):

private int degreeRotated(String filePath) {
        try {
            JpegImageMetadata meta = ((JpegImageMetadata) Sanselan.getMetadata(new File(filePath)));
            TiffImageMetadata data = null;
            if (meta != null) {
                data = meta.getExif();
            }
            int orientation = 0;
            if (data != null) {
                orientation = data.findField(ExifTagConstants.EXIF_TAG_ORIENTATION).getIntValue();
            } else {
                String[] projection = { Images.ImageColumns.ORIENTATION };
                Cursor c = getContentResolver().query(Uri.fromFile(new File(filePath)), projection, null, null, null);

                if (c != null && c.moveToFirst()) {
                    orientation = c.getInt(0);
                }
            }
            switch (orientation) {
                case 6:
                    return 90;
                case 8:
                    return 270;
                default:
                    return 0;

            }
            /*
             * } catch (JpegProcessingException e1) { e1.printStackTrace(); }
             * catch (MetadataException e) { e.printStackTrace(); }
             */} catch (ImageReadException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return 0;
    }

这是错误日志:

Description   Resource   Path   Location   Type
ImageReadException cannot be resolved to a type   Viewer.java   /Main/src/com/owleyes/moustache   line 687   Java Problem
ExifTagConstants cannot be resolved to a variable   Viewer.java   /Main/src/com/owleyes/moustache   line 666   Java Problem
TiffImageMetadata cannot be resolved to a type   Viewer.java   /Main/src/com/owleyes/moustache   line 660   Java Problem
Sanselan cannot be resolved   Viewer.java   /Main/src/com/owleyes/moustache   line 659   Java Problem
JpegImageMetadata cannot be resolved to a type   Viewer.java   /Main/src/com/owleyes/moustache   line 659   Java Problem
JpegImageMetadata cannot be resolved to a type   Viewer.java   /Main/src/com/owleyes/moustache   line 659   Java Problem
The import org.apache.sanselan cannot be resolved   Viewer.java   /Main/src/com/owleyes/moustache   line 11   Java Problem
The import org.apache.sanselan cannot be resolved   Viewer.java   /Main/src/com/owleyes/moustache   line 10   Java Problem
The import org.apache.sanselan cannot be resolved   Viewer.java   /Main/src/com/owleyes/moustache   line 9   Java Problem
The import org.apache.sanselan cannot be resolved   Viewer.java   /Main/src/com/owleyes/moustache   line 8   Java Problem
The import org.apache.sanselan cannot be resolved   Viewer.java   /Main/src/com/owleyes/moustache   line 7   Java Problem
1个回答

2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接