BitmapFactory decodeFile - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for BitmapFactory decodeFile method.

This code example shows how to use the following methods:decodeFile
        } 
    } 
 
    public static Bitmap requestDecode(JobContext jc, final String filePath,
            Options options) {
        if (options == null) options = new Options();
        jc.setCancelListener(new DecodeCanceller(options));
        return ensureGLCompatibleBitmap( 
                BitmapFactory.decodeFile(filePath, options));
    } 
 
    public static Bitmap requestDecode(JobContext jc, FileDescriptor fd, Options options) {
        if (options == null) options = new Options();
        jc.setCancelListener(new DecodeCanceller(options));
        return ensureGLCompatibleBitmap( 
                BitmapFactory.decodeFileDescriptor(fd, null, options));
    } 
 
    public static Bitmap requestDecode(JobContext jc, byte[] bytes,
            Options options) {
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:decodeFile
    /** 
     * Get the size of a bitmap from disk 
     * @param absoluteFileName 
     */ 
    public static BitmapSize getBitmapSizeFromFile(String absoluteFileName) {
		Options opts = new Options();
		opts.inJustDecodeBounds = true;
		BitmapFactory.decodeFile(absoluteFileName, opts);
		return new BitmapSize(opts.outWidth, opts.outHeight);
    } 
     
	public static void writeBitmapInFile(String absoluteFileName, Bitmap bitmap) throws IOException {
		writeBitmapInFile(new File(absoluteFileName), bitmap);
	} 
	 
	public static void writeBitmapInFile(String absoluteFileName, Bitmap bitmap, CompressFormat compressFormat) throws IOException {
		writeBitmapInFile(new File(absoluteFileName), bitmap, compressFormat, null);
	} 
	 
	public static void writeBitmapInFile(File file, Bitmap bitmap) throws IOException {
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:decodeFile
		if (f.exists()) {
			try { 
				return Bitmap.createScaledBitmap(BitmapFactory.decodeFile(getFileAvatar(id)), size, size, true);
			} catch (Exception e) {
				e.printStackTrace();
				Options opts =  new Options();
				opts.inSampleSize = 2;
				return Bitmap.createScaledBitmap(BitmapFactory.decodeFile(getFileAvatar(id), opts), size, size, true);
			} 
		} else { 
			return null; 
		} 
	} 
	 
	static public void setActivity(Context cnt)
    { 
 
        try { 
                File dir = new File(appDirectory);
                if (!dir.exists()) dir.mkdir();
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:decodeFile
        } 
    } 
 
    public static Bitmap requestDecode(JobContext jc, final String filePath,
            Options options) {
        if (options == null) options = new Options();
        jc.setCancelListener(new DecodeCanceller(options));
        return ensureGLCompatibleBitmap( 
                BitmapFactory.decodeFile(filePath, options));
    } 
 
    public static Bitmap requestDecode(JobContext jc, FileDescriptor fd, Options options) {
        if (options == null) options = new Options();
        jc.setCancelListener(new DecodeCanceller(options));
        return ensureGLCompatibleBitmap( 
                BitmapFactory.decodeFileDescriptor(fd, null, options));
    } 
 
    public static Bitmap requestDecode(JobContext jc, byte[] bytes,
            Options options) {
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:decodeFile, decodeStream
 
	public static final int UNCONSTRAINED = -1;
 
	// ���������Ϣ 
	public static Options getOptions(String path) {
		Options options = new Options();
		// ֻ��ߣ�����ȡ��� 
		options.inJustDecodeBounds = true;
		// ���ص��ڴ� 
		BitmapFactory.decodeFile(path, options);
		return options;
	} 
 
	// ���ͼ�� 
	private static Bitmap getBitmapByPath(String path, Options options,
			int screenWidth, int screenHeight)  {
		 
		 
		File file = new File(path);
		if (!file.exists()) {

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:decodeFile
        } 
    } 
 
    public static Bitmap requestDecode(JobContext jc, final String filePath,
            Options options) {
        if (options == null) options = new Options();
        jc.setCancelListener(new DecodeCanceller(options));
        return ensureGLCompatibleBitmap( 
                BitmapFactory.decodeFile(filePath, options));
    } 
 
    public static Bitmap requestDecode(JobContext jc, FileDescriptor fd, Options options) {
        if (options == null) options = new Options();
        jc.setCancelListener(new DecodeCanceller(options));
        return ensureGLCompatibleBitmap( 
                BitmapFactory.decodeFileDescriptor(fd, null, options));
    } 
 
    public static Bitmap requestDecode(JobContext jc, byte[] bytes,
            Options options) {
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:decodeFile
        } 
    } 
 
    public static Bitmap requestDecode(JobContext jc, final String filePath,
            Options options) {
        if (options == null) options = new Options();
        jc.setCancelListener(new DecodeCanceller(options));
        return ensureGLCompatibleBitmap( 
                BitmapFactory.decodeFile(filePath, options));
    } 
 
    public static Bitmap requestDecode(JobContext jc, FileDescriptor fd, Options options) {
        if (options == null) options = new Options();
        jc.setCancelListener(new DecodeCanceller(options));
        return ensureGLCompatibleBitmap( 
                BitmapFactory.decodeFileDescriptor(fd, null, options));
    } 
 
    public static Bitmap requestDecode(JobContext jc, byte[] bytes,
            Options options) {
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:decodeFile
        } 
    } 
 
    public static Bitmap requestDecode(JobContext jc, final String filePath,
            Options options) {
        if (options == null) options = new Options();
        jc.setCancelListener(new DecodeCanceller(options));
        return ensureGLCompatibleBitmap( 
                BitmapFactory.decodeFile(filePath, options));
    } 
 
    public static Bitmap requestDecode(JobContext jc, FileDescriptor fd, Options options) {
        if (options == null) options = new Options();
        jc.setCancelListener(new DecodeCanceller(options));
        return ensureGLCompatibleBitmap( 
                BitmapFactory.decodeFileDescriptor(fd, null, options));
    } 
 
    public static Bitmap requestDecode(JobContext jc, byte[] bytes,
            Options options) {
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:decodeFile
 
		return files;
	} 
 
	protected static Bitmap getThumbnail(File f) {
		Options thumbOptions = new Options();
		thumbOptions.inSampleSize = 8; 
 
		return getImage(f, thumbOptions);
	} 
 
	protected static Bitmap getWebPreview(File f) {
		return getImage(f, null);
	} 
 
	private static Bitmap getImage(File f,Options options) {
		Bitmap image = BitmapFactory.decodeFile(f.getAbsolutePath(), options);
		return image;
	} 
 

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:decodeFile
import android.os.Environment; 
import android.provider.MediaStore; 
 
public class ImageUtil { 
	public static Bitmap decodeBitmap(String filePath, int scale) {
		Options options = new BitmapFactory.Options();
		options.inSampleSize = scale;
		options.inPurgeable = true;
		return BitmapFactory.decodeFile(filePath, options);
	} 
 
	public static File createTempFile() throws IOException {
		return File.createTempFile("c6t__", ".tmp", Environment.getExternalStorageDirectory());
	} 
 
	public static Uri createTempFileUri() throws IOException {
		return Uri.parse(createTempFile().toURI().toString());
	} 
 
	public static Intent createCaptureImageIntent(Uri destUri) {
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related BitmapFactory decodeFile Questions & Answers:

Other BitmapFactory decodeFile Examples

207:				options.inSampleSize = 8;
208:	
209:				final Bitmap bitmap = BitmapFactory.decodeFile(fileUri.getPath(),
210:						options);
211:

Read More

15:				options.inSampleSize = 8;
16:	
17:				final Bitmap bitmap = BitmapFactory.decodeFile(fileUri.getPath(),
18:						options);
19:

Read More

55:	        BitmapFactory.Options options = new BitmapFactory.Options();
56:	        options.inPreferredConfig = Bitmap.Config.ARGB_8888;
57:	        Bitmap bitmap = BitmapFactory.decodeFile(_imagePaths.get(position), options);
58:	        imgDisplay.setImageBitmap(bitmap);
59:

Read More

decodeFile Method Overview
Decode a file path into a bitmap.
See Code Examples for other Android BitmapFactory Methods: