當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。