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


Java ExifInterface.ORIENTATION_ROTATE_90属性代码示例

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


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

示例1: getPictureDegree

/**
 * 获取图片的旋转角度
 * http://www.eoeandroid.com/thread-196978-1-1.html
 * @param path 照片路径
 * @return
 */
public static int getPictureDegree(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:CoderCF,项目名称:TakePhoto,代码行数:30,代码来源:FileUtil.java

示例2: getRotateDegree

/**
 * 获取图片旋转角度
 *
 * @param filePath 文件路径
 * @return 旋转角度
 */
public static int getRotateDegree(String filePath) {
    int degree = 0;
    try {
        ExifInterface exifInterface = new ExifInterface(filePath);
        int orientation = exifInterface.getAttributeInt(
                ExifInterface.TAG_ORIENTATION,
                ExifInterface.ORIENTATION_NORMAL);
        switch (orientation) {
            default:
            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:angcyo,项目名称:RLibrary,代码行数:30,代码来源:ImageUtils.java

示例3: 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

示例4: 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:yangxp108,项目名称:MVPArms_Fragment-fragment,代码行数:30,代码来源:DrawableProvider.java

示例5: readPictureDegree

/**
 * 读取图片属性:旋转的角度
 *
 * @param path 图片绝对路径
 * @return degree旋转的角度
 */
public 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:smartbeng,项目名称:PaoMovie,代码行数:27,代码来源:ImageUtils.java

示例6: getRotateDegree

/**
 * 获取图片旋转角度
 *
 * @param filePath 文件路径
 * @return 旋转角度
 */
public static int getRotateDegree(final String filePath) {
    int degree = 0;
    try {
        ExifInterface exifInterface = new ExifInterface(filePath);
        int orientation = exifInterface.getAttributeInt(
                ExifInterface.TAG_ORIENTATION,
                ExifInterface.ORIENTATION_NORMAL);
        switch (orientation) {
            default:
            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:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:ImageUtils.java

示例7: setMatrixOrientation

private void setMatrixOrientation(Matrix m, int o) {
    switch (o) {
        case ExifInterface.ORIENTATION_NORMAL:
            break;
        case ExifInterface.ORIENTATION_ROTATE_180:
            m.postRotate(180);
            break;
        case ExifInterface.ORIENTATION_ROTATE_270:
            m.postRotate(270);
            break;
        case ExifInterface.ORIENTATION_ROTATE_90:
            m.postRotate(90);
            break;
        default:
            break;
    }
}
 
开发者ID:ericberman,项目名称:MyFlightbookAndroid,代码行数:17,代码来源:MFBImageInfo.java

示例8: readPictureDegree

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:PlutoArchitecture,项目名称:Pluto-Android,代码行数:23,代码来源:PhotoUtil.java

示例9: readPictureDegree

/**
 * 获取图片的旋转角度
 *
 * @param path path
 * @return 图片的旋转角度
 */
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:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:27,代码来源:PicturesCompressor.java

示例10: getBitmapDegree

/**
 * 获取正确旋转角度的图片
 * 获取图片的旋转角度
 * @param bm
 * @param path 图片路径
 * @return 旋转角度
 */
public static Bitmap getBitmapDegree(Bitmap bm,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 rotateBitmapByDegree(bm,degree);
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:31,代码来源:BitmapUtils.java

示例11: readPictureDegree

private 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:PlutoArchitecture,项目名称:Pluto-Android,代码行数:23,代码来源:BitmapUtil.java

示例12: rotateBitmap

/**
     * 用于压缩时旋转图片
     *
     * @throws IOException
     * @throws OutOfMemoryError
     */
    public static Bitmap rotateBitmap(String srcFilePath, Bitmap bitmap) throws IOException, OutOfMemoryError {
        float degree = 0F;
        try {
            ExifInterface exif = new ExifInterface(srcFilePath);
            switch (exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED)) {
                case ExifInterface.ORIENTATION_ROTATE_90:
                    degree = 90F;
                    break;
                case ExifInterface.ORIENTATION_ROTATE_180:
                    degree = 180F;
                    break;
                case ExifInterface.ORIENTATION_ROTATE_270:
                    degree = 270F;
                    break;
                default:
                    break;
            }
        } catch (IOException e) {
            e.printStackTrace();
//            01-23 11:03:04.040 W/ExifInterface(29568): Invalid image.
//            01-23 11:03:04.040 W/ExifInterface(29568): java.io.IOException: Invalid marker: 89
//            01-23 11:03:04.040 W/ExifInterface(29568): 	at android.media.ExifInterface.getJpegAttributes(ExifInterface.java:1656)
//            01-23 11:03:04.040 W/ExifInterface(29568): 	at android.media.ExifInterface.loadAttributes(ExifInterface.java:1360)
//            01-23 11:03:04.040 W/ExifInterface(29568): 	at android.media.ExifInterface.<init>(ExifInterface.java:1064)
        }

        Matrix matrix = new Matrix();
        matrix.setRotate(degree, bitmap.getWidth(), bitmap.getHeight());
        Bitmap b2 = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
        if (bitmap != b2) {
            bitmap.recycle();
            bitmap = b2;
        }
        return bitmap;
    }
 
开发者ID:miLLlulei,项目名称:Accessibility,代码行数:41,代码来源:BitmapUtils.java

示例13: shouldRotate

public 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:GitPhoenix,项目名称:VanGogh,代码行数:12,代码来源:PhotoMetadataUtils.java

示例14: defineExifOrientation

protected ExifInfo defineExifOrientation(String imageUri) {
	int rotation = 0;
	boolean flip = false;
	try {
		ExifInterface exif = new ExifInterface(Scheme.FILE.crop(imageUri));
		int exifOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
		switch (exifOrientation) {
			case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
				flip = true;
			case ExifInterface.ORIENTATION_NORMAL:
				rotation = 0;
				break;
			case ExifInterface.ORIENTATION_TRANSVERSE:
				flip = true;
			case ExifInterface.ORIENTATION_ROTATE_90:
				rotation = 90;
				break;
			case ExifInterface.ORIENTATION_FLIP_VERTICAL:
				flip = true;
			case ExifInterface.ORIENTATION_ROTATE_180:
				rotation = 180;
				break;
			case ExifInterface.ORIENTATION_TRANSPOSE:
				flip = true;
			case ExifInterface.ORIENTATION_ROTATE_270:
				rotation = 270;
				break;
		}
	} catch (IOException e) {
		L.w("Can't read EXIF tags from file [%s]", imageUri);
	}
	return new ExifInfo(rotation, flip);
}
 
开发者ID:siwangqishiq,项目名称:ImageLoaderSupportGif,代码行数:33,代码来源:BaseImageDecoder.java

示例15: 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


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