当前位置: 首页>>代码示例>>Java>>正文


Java ExifInterface.ORIENTATION_ROTATE_270属性代码示例

本文整理汇总了Java中android.media.ExifInterface.ORIENTATION_ROTATE_270属性的典型用法代码示例。如果您正苦于以下问题:Java ExifInterface.ORIENTATION_ROTATE_270属性的具体用法?Java ExifInterface.ORIENTATION_ROTATE_270怎么用?Java ExifInterface.ORIENTATION_ROTATE_270使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.media.ExifInterface的用法示例。


在下文中一共展示了ExifInterface.ORIENTATION_ROTATE_270属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: rotateBitmapByExif

/**
 * Rotate the given image by given Exif value.<br>
 * If no rotation is required the image will not be rotated.<br>
 * New bitmap is created and the old one is recycled.
 */
static RotateBitmapResult rotateBitmapByExif(Bitmap bitmap, ExifInterface exif) {
    int degrees;
    int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
    switch (orientation) {
        case ExifInterface.ORIENTATION_ROTATE_90:
            degrees = 90;
            break;
        case ExifInterface.ORIENTATION_ROTATE_180:
            degrees = 180;
            break;
        case ExifInterface.ORIENTATION_ROTATE_270:
            degrees = 270;
            break;
        default:
            degrees = 0;
            break;
    }
    return new RotateBitmapResult(bitmap, degrees);
}
 
开发者ID:chuch0805,项目名称:Android-Demo_ImageCroper,代码行数:24,代码来源:BitmapUtils.java

示例2: getOrientationFromExifInterface

private int getOrientationFromExifInterface(Uri uri) {
    try {
        ExifInterface exif = new ExifInterface(uri.getPath());
        int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1);
        switch (orientation) {
            case ExifInterface.ORIENTATION_ROTATE_270:
                return 270;
            case ExifInterface.ORIENTATION_ROTATE_180:
                return 180;
            case ExifInterface.ORIENTATION_ROTATE_90:
                return 90;
            case ExifInterface.ORIENTATION_NORMAL:
                return 0;
            default:
                return -1;
        }
    } catch (IOException e) {
        return -1;
    }
}
 
开发者ID:WorldBank-Transport,项目名称:RoadLab-Pro,代码行数:20,代码来源:NewTagFragment.java

示例3: readPictureDegree

/**
 * 读取图片属性:旋转的角度
 * @param path 图片绝对路径
 * @return degree旋转的角度
 */
public static int readPictureDegree(String path) {
    int degree = 0;
    try {
        ExifInterface exifInterface = new ExifInterface(path);
        int orientation = exifInterface.getAttributeInt(
                ExifInterface.TAG_ORIENTATION,
                ExifInterface.ORIENTATION_NORMAL);
        switch (orientation) {
            case ExifInterface.ORIENTATION_ROTATE_90:
                degree = 90;
                break;
            case ExifInterface.ORIENTATION_ROTATE_180:
                degree = 180;
                break;
            case ExifInterface.ORIENTATION_ROTATE_270:
                degree = 270;
                break;
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return degree;
}
 
开发者ID:Louis19910615,项目名称:youkes_browser,代码行数:28,代码来源:HelpUtils.java

示例4: exifToDegrees

public static int exifToDegrees(int exifOrientation) {
    int rotation;
    switch (exifOrientation) {
        case ExifInterface.ORIENTATION_ROTATE_90:
        case ExifInterface.ORIENTATION_TRANSPOSE:
            rotation = 90;
            break;
        case ExifInterface.ORIENTATION_ROTATE_180:
        case ExifInterface.ORIENTATION_FLIP_VERTICAL:
            rotation = 180;
            break;
        case ExifInterface.ORIENTATION_ROTATE_270:
        case ExifInterface.ORIENTATION_TRANSVERSE:
            rotation = 270;
            break;
        default:
            rotation = 0;
    }
    return rotation;
}
 
开发者ID:BrandonVargas,项目名称:AndroidOCRFforID,代码行数:20,代码来源:BitmapLoadUtils.java

示例5: getPicRotate

/**
 * 读取图片文件旋转的角度
 *
 * @param path 图片绝对路径
 * @return 图片旋转的角度
 */
public static int getPicRotate(String path) {
    int degree = 0;
    try {
        ExifInterface exifInterface = new ExifInterface(path);
        int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
        switch (orientation) {
            case ExifInterface.ORIENTATION_ROTATE_90:
                degree = 90;
                break;
            case ExifInterface.ORIENTATION_ROTATE_180:
                degree = 180;
                break;
            case ExifInterface.ORIENTATION_ROTATE_270:
                degree = 270;
                break;
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return degree;
}
 
开发者ID:StickyTolt,项目名称:ForeverLibrary,代码行数:27,代码来源:PictureUtil.java

示例6: rotatingImage

private Bitmap rotatingImage(Bitmap bitmap) {
    if (srcExif == null) return bitmap;

    Matrix matrix = new Matrix();
    int angle = 0;
    int orientation = srcExif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
    switch (orientation) {
        case ExifInterface.ORIENTATION_ROTATE_90:
            angle = 90;
            break;
        case ExifInterface.ORIENTATION_ROTATE_180:
            angle = 180;
            break;
        case ExifInterface.ORIENTATION_ROTATE_270:
            angle = 270;
            break;
    }

    matrix.postRotate(angle);

    return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:22,代码来源:CompressEngine.java

示例7: getImageSpinAngle

/**
 * obtain the image rotation angle
 *
 * @param path path of target image
 */
private int getImageSpinAngle(String path) {
    int degree = 0;
    try {
        ExifInterface exifInterface = new ExifInterface(path);
        int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
        switch (orientation) {
            case ExifInterface.ORIENTATION_ROTATE_90:
                degree = 90;
                break;
            case ExifInterface.ORIENTATION_ROTATE_180:
                degree = 180;
                break;
            case ExifInterface.ORIENTATION_ROTATE_270:
                degree = 270;
                break;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return degree;
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:26,代码来源:Luban.java

示例8: readPictureDegree

/**
 * 读取图片属性:旋转的角度
 *
 * @param path 图片绝对路径
 * @return degree旋转的角度
 */
public static int readPictureDegree(String path) {
    int degree = 0;
    try {
        ExifInterface exifInterface = new ExifInterface(path);
        int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
        switch (orientation) {
            case ExifInterface.ORIENTATION_ROTATE_90:
                degree = 90;
                break;
            case ExifInterface.ORIENTATION_ROTATE_180:
                degree = 180;
                break;
            case ExifInterface.ORIENTATION_ROTATE_270:
                degree = 270;
                break;
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return degree;
}
 
开发者ID:JJS-CN,项目名称:JBase,代码行数:27,代码来源:PictureUtils.java

示例9: getBitmapDegree

/**
 * 读取图片的旋转的角度
 *
 * @param path 图片绝对路径
 * @return 图片的旋转角度
 */
public static int getBitmapDegree(String path) {
    int degree = 0;
    try {
        // 从指定路径下读取图片,并获取其EXIF信息
        ExifInterface exifInterface = new ExifInterface(path);
        // 获取图片的旋转信息
        int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION,
                ExifInterface.ORIENTATION_NORMAL);
        switch (orientation) {
            case ExifInterface.ORIENTATION_ROTATE_90:
                degree = 90;
                break;
            case ExifInterface.ORIENTATION_ROTATE_180:
                degree = 180;
                break;
            case ExifInterface.ORIENTATION_ROTATE_270:
                degree = 270;
                break;
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return degree;
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:30,代码来源:ImageUtils.java

示例10: getOrientation

public static int getOrientation(final String imagePath) {
    int rotate = 0;
    try {
        File imageFile = new File(imagePath);
        ExifInterface exif = new ExifInterface(imageFile.getAbsolutePath());
        int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface
                .ORIENTATION_NORMAL);
        switch (orientation) {
            case ExifInterface.ORIENTATION_ROTATE_270:
                rotate = 270;
                break;
            case ExifInterface.ORIENTATION_ROTATE_180:
                rotate = 180;
                break;
            case ExifInterface.ORIENTATION_ROTATE_90:
                rotate = 90;
                break;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return rotate;
}
 
开发者ID:viseator,项目名称:MontageCam,代码行数:23,代码来源:BitmapUtils.java

示例11: setOrientation

public void setOrientation() throws IOException {
    if (TextUtils.isEmpty(getAbsoluteImagePath())) {
        return;
    }
    BitmapFactory.Options bmOptions = new BitmapFactory.Options();
    Bitmap bitmap = BitmapFactory.decodeFile(getAbsoluteImagePath(), bmOptions);

    ExifInterface ei = new ExifInterface(getAbsoluteImagePath());
    int orientation = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION,
            ExifInterface.ORIENTATION_UNDEFINED);

    switch (orientation) {

        case ExifInterface.ORIENTATION_ROTATE_90:
            writeFile(rotateImage(bitmap, 90));
            break;
        case ExifInterface.ORIENTATION_ROTATE_180:
            writeFile(rotateImage(bitmap, 180));
            break;

        case ExifInterface.ORIENTATION_ROTATE_270:
            writeFile(rotateImage(bitmap, 270));
            break;

        case ExifInterface.ORIENTATION_NORMAL:

        default:
            break;
    }
}
 
开发者ID:BANKEX,项目名称:smart-asset-iot-android-demo,代码行数:30,代码来源:ImageUtils.java

示例12: exifToDegrees

private int exifToDegrees(int exifOrientation) {
    if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) {
        return 90;
    } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_180) {
        return 180;
    } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_270) {
        return 270;
    } else {
        return 0;
    }
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:11,代码来源:CameraLauncher.java

示例13: getOrientation

public int getOrientation() {
    int o = Integer.parseInt(this.orientation);

    if (o == ExifInterface.ORIENTATION_NORMAL) {
        return 0;
    } else if (o == ExifInterface.ORIENTATION_ROTATE_90) {
        return 90;
    } else if (o == ExifInterface.ORIENTATION_ROTATE_180) {
        return 180;
    } else if (o == ExifInterface.ORIENTATION_ROTATE_270) {
        return 270;
    } else {
        return 0;
    }
}
 
开发者ID:aabognah,项目名称:LoRaWAN-Smart-Parking,代码行数:15,代码来源:ExifHelper.java

示例14: getRotateAngle

/**
 * 获取图片旋转角度
 *
 * @param filePath
 * @return
 */
public static int getRotateAngle(String filePath) {
    int angle = 0;
    try {
        ExifInterface exif = new ExifInterface(filePath);
        int orientation = exif.getAttributeInt(
                ExifInterface.TAG_ORIENTATION,
                ExifInterface.ORIENTATION_UNDEFINED);
        switch (orientation) {
            case ExifInterface.ORIENTATION_ROTATE_90:
                angle = 90;
                break;
            case ExifInterface.ORIENTATION_ROTATE_180:
                angle = 180;
                break;
            case ExifInterface.ORIENTATION_ROTATE_270:
                angle = 270;
                break;
            default:
                angle = 0;
                break;
        }
    } catch (Throwable ex) {
        LogUtil.e(ex.getMessage(), ex);
    }
    return angle;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:32,代码来源:ImageDecoder.java

示例15: shouldRotate

private static boolean shouldRotate(ContentResolver resolver, Uri uri) {
    ExifInterface exif;
    try {
        exif = ExifInterfaceCompat.newInstance(getPath(resolver, uri));
    } catch (IOException e) {
        Log.e(TAG, "could not read exif info of the image: " + uri);
        return false;
    }
    int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1);
    return orientation == ExifInterface.ORIENTATION_ROTATE_90
            || orientation == ExifInterface.ORIENTATION_ROTATE_270;
}
 
开发者ID:sathishmscict,项目名称:Matisse-Image-and-Video-Selector,代码行数:12,代码来源:PhotoMetadataUtils.java


注:本文中的android.media.ExifInterface.ORIENTATION_ROTATE_270属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。