Java Code Examples for android.graphics.Bitmap.copy()

The following are Jave code examples for showing how to use copy() of the android.graphics.Bitmap class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: EditPhoto   File: Utils.java   View Source Code Vote up 6 votes
public static Bitmap brightBitmap(Bitmap bitmap, int brightness) {
    float[] colorTransform = {
            1, 0, 0, 0, brightness,
            0, 1, 0, 0, brightness,
            0, 0, 1, 0, brightness,
            0, 0, 0, 1, 0};

    ColorMatrix colorMatrix = new ColorMatrix();
    colorMatrix.setSaturation(0f);
    colorMatrix.set(colorTransform);

    ColorMatrixColorFilter colorFilter = new ColorMatrixColorFilter(colorMatrix);
    Paint paint = new Paint();
    paint.setColorFilter(colorFilter);


    Bitmap resultBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
    Canvas canvas = new Canvas(resultBitmap);
    canvas.drawBitmap(resultBitmap, 0, 0, paint);

    return resultBitmap;
}
 
Example 2
Project: memento-app   File: ImageHelper.java   View Source Code Vote up 6 votes
public static Bitmap highlightSelectedFaceThumbnail(Bitmap originalBitmap) {
    Bitmap bitmap = originalBitmap.copy(Bitmap.Config.ARGB_8888, true);
    Canvas canvas = new Canvas(bitmap);
    Paint paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.STROKE);
    paint.setColor(Color.parseColor("#3399FF"));
    int stokeWidth = Math.max(originalBitmap.getWidth(), originalBitmap.getHeight()) / 10;
    if (stokeWidth == 0) {
        stokeWidth = 1;
    }
    bitmap.getWidth();
    paint.setStrokeWidth(stokeWidth);
    canvas.drawRect(
            0,
            0,
            bitmap.getWidth(),
            bitmap.getHeight(),
            paint);

    return bitmap;
}
 
Example 3
Project: LJFramework   File: ImageUtils.java   View Source Code Vote up 6 votes
/**
 * 添加图片水印
 *
 * @param src 源图片
 * @param watermark 图片水印
 * @param x 起始坐标x
 * @param y 起始坐标y
 * @param alpha 透明度
 * @param recycle 是否回收
 * @return 带有图片水印的图片
 */
public static Bitmap addImageWatermark(Bitmap src, Bitmap watermark, int x, int y, int alpha, boolean recycle) {
    if (isEmptyBitmap(src)) {
        return null;
    }
    Bitmap ret = src.copy(src.getConfig(), true);
    if (!isEmptyBitmap(watermark)) {
        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
        Canvas canvas = new Canvas(ret);
        paint.setAlpha(alpha);
        canvas.drawBitmap(watermark, x, y, paint);
    }
    if (recycle && !src.isRecycled()) {
        src.recycle();
    }
    return ret;
}
 
Example 4
Project: BarcodeReaderView   File: BarcodeReaderHandler.java   View Source Code Vote up 6 votes
@Override
public void handleMessage(Message message) {
    switch (message.what) {
        case MESSAGE_RESTART_PREVIEW:
            restartPreviewAndDecode();
            break;
        case MESSAGE_DECODE_SUCCEEDED:
            state = State.SUCCESS;
            Bundle bundle = message.getData();
            Bitmap barcode = null;
            float scaleFactor = 1.0f;
            if (bundle != null) {
                byte[] compressedBitmap = bundle.getByteArray(DecodeThread.BARCODE_BITMAP);
                if (compressedBitmap != null) {
                    barcode = BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length, null);
                    // Mutable copy:
                    barcode = barcode.copy(Bitmap.Config.ARGB_8888, true);
                }
                scaleFactor = bundle.getFloat(DecodeThread.BARCODE_SCALED_FACTOR);
            }
            barcodeReaderView.handleDecode((Result) message.obj, barcode, scaleFactor);
            break;
        case MESSAGE_DECODE_FAILED:
            // We're decoding as fast as possible, so when one decode fails, start another.
            state = State.PREVIEW;
            cameraManager.requestPreviewFrame(decodeThread.getHandler(), MESSAGE_DECODE);
            break;
    }
}
 
Example 5
Project: AndroidUtilCode-master   File: ImageUtils.java   View Source Code Vote up 5 votes
/**
 * 添加文字水印
 *
 * @param src      源图片
 * @param content  水印文本
 * @param textSize 水印字体大小
 * @param color    水印字体颜色
 * @param x        起始坐标x
 * @param y        起始坐标y
 * @param recycle  是否回收
 * @return 带有文字水印的图片
 */
public static Bitmap addTextWatermark(Bitmap src, String content, float textSize, int color, float x,
                                      float y, boolean recycle) {
    if (isEmptyBitmap(src) || content == null) return null;
    Bitmap ret = src.copy(src.getConfig(), true);
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    Canvas canvas = new Canvas(ret);
    paint.setColor(color);
    paint.setTextSize(textSize);
    Rect bounds = new Rect();
    paint.getTextBounds(content, 0, content.length(), bounds);
    canvas.drawText(content, x, y + textSize, paint);
    if (recycle && !src.isRecycled()) src.recycle();
    return ret;
}
 
Example 6
Project: RLibrary   File: ImageUtils.java   View Source Code Vote up 5 votes
/**
 * 添加文字水印
 *
 * @param src      源图片
 * @param content  水印文本
 * @param textSize 水印字体大小
 * @param color    水印字体颜色
 * @param x        起始坐标x
 * @param y        起始坐标y
 * @param recycle  是否回收
 * @return 带有文字水印的图片
 */
public static Bitmap addTextWatermark(Bitmap src, String content, float textSize, int color, float x,
                                      float y, boolean recycle) {
    if (isEmptyBitmap(src) || content == null) return null;
    Bitmap ret = src.copy(src.getConfig(), true);
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    Canvas canvas = new Canvas(ret);
    paint.setColor(color);
    paint.setTextSize(textSize);
    Rect bounds = new Rect();
    paint.getTextBounds(content, 0, content.length(), bounds);
    canvas.drawText(content, x, y + textSize, paint);
    if (recycle && !src.isRecycled()) src.recycle();
    return ret;
}
 
Example 7
Project: HeadlineNews   File: ImageUtils.java   View Source Code Vote up 5 votes
/**
 * 添加图片水印
 *
 * @param src       源图片
 * @param watermark 图片水印
 * @param x         起始坐标x
 * @param y         起始坐标y
 * @param alpha     透明度
 * @param recycle   是否回收
 * @return 带有图片水印的图片
 */
public static Bitmap addImageWatermark(final Bitmap src, final Bitmap watermark, final int x, final int y, final int alpha, final boolean recycle) {
    if (isEmptyBitmap(src)) return null;
    Bitmap ret = src.copy(src.getConfig(), true);
    if (!isEmptyBitmap(watermark)) {
        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
        Canvas canvas = new Canvas(ret);
        paint.setAlpha(alpha);
        canvas.drawBitmap(watermark, x, y, paint);
    }
    if (recycle && !src.isRecycled()) src.recycle();
    return ret;
}
 
Example 8
Project: Android-Demo_ImageCroper   File: BitmapUtils.java   View Source Code Vote up 5 votes
/**
 * Crop image bitmap from given bitmap using the given points in the original bitmap and the given rotation.<br>
 * if the rotation is not 0,90,180 or 270 degrees then we must first crop a larger area of the image that
 * contains the requires rectangle, rotate and then crop again a sub rectangle.
 *
 * @param scale how much to scale the cropped image part, use 0.5 to lower the image by half (OOM handling)
 */
private static Bitmap cropBitmapObjectWithScale(Bitmap bitmap, float[] points, int degreesRotated,
                                                boolean fixAspectRatio, int aspectRatioX, int aspectRatioY, float scale) {

    // get the rectangle in original image that contains the required cropped area (larger for non rectangular crop)
    Rect rect = getRectFromPoints(points, bitmap.getWidth(), bitmap.getHeight(), fixAspectRatio, aspectRatioX, aspectRatioY);

    // crop and rotate the cropped image in one operation
    Matrix matrix = new Matrix();
    matrix.setScale(scale, scale);
    matrix.postRotate(degreesRotated, bitmap.getWidth() / 2, bitmap.getHeight() / 2);
    Bitmap result = Bitmap.createBitmap(bitmap, rect.left, rect.top, rect.width(), rect.height(), matrix, true);

    if (result == bitmap) {
        // corner case when all bitmap is selected, no worth optimizing for it
        result = bitmap.copy(bitmap.getConfig(), false);
    }

    // rotating by 0, 90, 180 or 270 degrees doesn't require extra cropping
    if (degreesRotated % 90 != 0) {

        // extra crop because non rectangular crop cannot be done directly on the image without rotating first
        result = cropForRotatedImage(result, points, rect, degreesRotated, fixAspectRatio, aspectRatioX, aspectRatioY);
    }

    return result;
}
 
Example 9
Project: IOSDialog   File: IOSDialog.java   View Source Code Vote up 5 votes
private Bitmap adjust(Bitmap src) {
    int to = Color.RED;

    Bitmap bitmap = src.copy(Bitmap.Config.ARGB_8888, true);
    for(int x = 0;x < bitmap.getWidth();x++)
        for(int y = 0;y < bitmap.getHeight();y++)
            if(match(bitmap.getPixel(x, y)))
                bitmap.setPixel(x, y, to);

    return bitmap;
}
 
Example 10
Project: ultrasonic   File: ImageLoader.java   View Source Code Vote up 5 votes
public Bitmap getImageBitmap(String username, int size)
{
	Bitmap bitmap = cache.get(getKey(username, size));

	if (bitmap != null && !bitmap.isRecycled())
	{
		Bitmap.Config config = bitmap.getConfig();
		return bitmap.copy(config, false);
	}

	return null;
}
 
Example 11
Project: BaseCore   File: ImageUtils.java   View Source Code Vote up 5 votes
/**
 * 添加图片水印
 *
 * @param src       源图片
 * @param watermark 图片水印
 * @param x         起始坐标x
 * @param y         起始坐标y
 * @param alpha     透明度
 * @param recycle   是否回收
 * @return 带有图片水印的图片
 */
public static Bitmap addImageWatermark(Bitmap src, Bitmap watermark, int x, int y, int alpha, boolean recycle) {
    if (isEmptyBitmap(src)) return null;
    Bitmap ret = src.copy(src.getConfig(), true);
    if (!isEmptyBitmap(watermark)) {
        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
        Canvas canvas = new Canvas(ret);
        paint.setAlpha(alpha);
        canvas.drawBitmap(watermark, x, y, paint);
    }
    if (recycle && !src.isRecycled()) src.recycle();
    return ret;
}
 
Example 12
Project: react-native-sunmi-inner-printer   File: BitmapUtils.java   View Source Code Vote up 5 votes
public static Bitmap drawTextToBitmap(Context gContext, int gResId, String gText) {  
    	  Log.i(TAG, "drawTextToBitmap = " + gText);
		  Resources resources = gContext.getResources();  
		  float scale = resources.getDisplayMetrics().density;  
		  Bitmap bitmap =   
		     BitmapFactory.decodeResource(resources, gResId);  
		   
		  Bitmap.Config bitmapConfig =
		      bitmap.getConfig();  
		  // set default bitmap config if none   
		 if(bitmapConfig == null) {  
		    bitmapConfig = Bitmap.Config.ARGB_8888;
		  }  
		  // resource bitmaps are imutable,    
		  // so we need to convert it to mutable one   
		  bitmap = bitmap.copy(bitmapConfig, true);  
		   
		  Canvas canvas = new Canvas(bitmap);  
		  // new antialised Paint   
		  Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);  
		  // text color - #3D3D3D   
		  paint.setColor(Color.WHITE);  
		  // text size in pixels   
		  paint.setTextSize((int) (12 * scale));  
		  // text shadow   
//		  paint.setShadowLayer(1f, 0f, 1f, Color.WHITE);  
		   
		  // draw text to the Canvas center   
		  Rect bounds = new Rect();  
		  paint.getTextBounds(gText, 0, gText.length(), bounds);  
		  int x = (bitmap.getWidth() - bounds.width())/2;  
		  int y = (bitmap.getHeight())/2 + (int)scale*2;  
		   
		  canvas.drawText(gText,  x, y, paint);  
	      
		  canvas.save(Canvas.ALL_SAVE_FLAG); 
	      canvas.restore();
		   
		  return bitmap;  
	}
 
Example 13
Project: Hitalk   File: RenderScriptBlurHelper.java   View Source Code Vote up 5 votes
/**
 * blur a given bitmap
 *
 * @param sentBitmap       bitmap to blur
 * @param radius           blur radius
 * @param canReuseInBitmap true if bitmap must be reused without blur
 * @param context          used by RenderScript, can be null if RenderScript disabled
 * @return blurred bitmap
 */
public static Bitmap doBlur(Bitmap sentBitmap, int radius, boolean canReuseInBitmap, Context context) {
    Bitmap bitmap;

    if (canReuseInBitmap) {
        bitmap = sentBitmap;
    } else {
        bitmap = sentBitmap.copy(sentBitmap.getConfig(), true);
    }

    if (bitmap.getConfig() == Bitmap.Config.RGB_565) {
        // RenderScript hates RGB_565 so we convert it to ARGB_8888
        // (see http://stackoverflow.com/questions/21563299/
        // defect-of-image-with-scriptintrinsicblur-from-support-library)
        bitmap = convertRGB565toARGB888(bitmap);
    }

    try {
        final RenderScript rs = RenderScript.create(context);
        final Allocation input = Allocation.createFromBitmap(rs, bitmap, Allocation.MipmapControl.MIPMAP_NONE,
            Allocation.USAGE_SCRIPT);
        final Allocation output = Allocation.createTyped(rs, input.getType());
        final ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
        script.setRadius(radius);
        script.setInput(input);
        script.forEach(output);
        output.copyTo(bitmap);
        return bitmap;
    } catch (RSRuntimeException e) {
        Log.e(TAG, "RenderScript known error : https://code.google.com/p/android/issues/detail?id=71347 "
            + "continue with the FastBlur approach.");
    }

    return null;
}
 
Example 14
Project: betterHotels   File: RSBlurProcess.java   View Source Code Vote up 5 votes
@Override
public Bitmap blur(Bitmap original, float radius) {
	int width = original.getWidth();
	int height = original.getHeight();
	Bitmap blurred = original.copy(Bitmap.Config.ARGB_8888, true);

	ScriptC_blur blurScript = new ScriptC_blur(_rs, context.getResources(), R.raw.blur);

	Allocation inAllocation = Allocation.createFromBitmap(_rs, blurred, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);

	blurScript.set_gIn(inAllocation);
	blurScript.set_width(width);
	blurScript.set_height(height);
	blurScript.set_radius((int) radius);

	int[] row_indices = new int[height];
	for (int i = 0; i < height; i++) {
		row_indices[i] = i;
	}

	Allocation rows = Allocation.createSized(_rs, Element.U32(_rs), height, Allocation.USAGE_SCRIPT);
	rows.copyFrom(row_indices);

	row_indices = new int[width];
	for (int i = 0; i < width; i++) {
		row_indices[i] = i;
	}

	Allocation columns = Allocation.createSized(_rs, Element.U32(_rs), width, Allocation.USAGE_SCRIPT);
	columns.copyFrom(row_indices);

	blurScript.forEach_blur_h(rows);
	blurScript.forEach_blur_v(columns);
	inAllocation.copyTo(blurred);

	return blurred;
}
 
Example 15
Project: Android-UtilCode   File: ImageUtils.java   View Source Code Vote up 5 votes
/**
 * 添加文字水印
 *
 * @param src      源图片
 * @param content  水印文本
 * @param textSize 水印字体大小
 * @param color    水印字体颜色
 * @param x        起始坐标x
 * @param y        起始坐标y
 * @param recycle  是否回收
 * @return 带有文字水印的图片
 */
public static Bitmap addTextWatermark(Bitmap src, String content, float textSize, int color, float x,
                                      float y, boolean recycle) {
    if (isEmptyBitmap(src) || content == null) return null;
    Bitmap ret = src.copy(src.getConfig(), true);
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    Canvas canvas = new Canvas(ret);
    paint.setColor(color);
    paint.setTextSize(textSize);
    Rect bounds = new Rect();
    paint.getTextBounds(content, 0, content.length(), bounds);
    canvas.drawText(content, x, y + textSize, paint);
    if (recycle && !src.isRecycled()) src.recycle();
    return ret;
}
 
Example 16
Project: Android-UtilCode   File: ImageUtils.java   View Source Code Vote up 5 votes
/**
 * 添加图片水印
 *
 * @param src       源图片
 * @param watermark 图片水印
 * @param x         起始坐标x
 * @param y         起始坐标y
 * @param alpha     透明度
 * @param recycle   是否回收
 * @return 带有图片水印的图片
 */
public static Bitmap addImageWatermark(Bitmap src, Bitmap watermark, int x, int y, int alpha, boolean recycle) {
    if (isEmptyBitmap(src)) return null;
    Bitmap ret = src.copy(src.getConfig(), true);
    if (!isEmptyBitmap(watermark)) {
        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
        Canvas canvas = new Canvas(ret);
        paint.setAlpha(alpha);
        canvas.drawBitmap(watermark, x, y, paint);
    }
    if (recycle && !src.isRecycled()) src.recycle();
    return ret;
}
 
Example 17
Project: QuickDrawEverywhere   File: ZoomRegionView.java   View Source Code Vote up 5 votes
public void drawZoomRegion(Bitmap parentContent, Rect sourceRect, float scaleFactor) {
    this.mParentContent = parentContent;
    mZoomedRegion = new Rect((int) (sourceRect.left / scaleFactor), (int) (sourceRect.top / scaleFactor),
            (int) (sourceRect.right / scaleFactor), (int) (sourceRect.bottom / scaleFactor));
    mSourceRect = new Rect(0, 0, mParentContent.getWidth(), mParentContent.getHeight());
    mDestRect = new Rect(0, 0, getWidth(), getHeight());

    Bitmap init = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
    mZoomOverlay = init.copy(Bitmap.Config.ARGB_8888, true);
    init.recycle();
    mCanvasOverlay = new Canvas(mZoomOverlay);

    invalidate();
}
 
Example 18
Project: react-native-sunmi-inner-printer   File: BitmapUtils.java   View Source Code Vote up 4 votes
/**
 * Decodes bitmap (maybe immutable) that keeps aspect-ratio and spans most within the bounds.
 */
public Bitmap decodeBitmap(byte[] data, int width, int height){
	Log.i(TAG, "width = " + width + " , " + "height = " + height);
    Bitmap bitmap = null;
    try {
        // TODO: Take max pixels allowed into account for calculation to avoid possible OOM.
        Rect bounds = getBitmapBounds(data);
        int sampleSize = Math.max(bounds.width() / width, bounds.height() / height);
        sampleSize = Math.min(sampleSize,
                Math.max(bounds.width() / height, bounds.height() / width));

        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inSampleSize = Math.max(sampleSize, 1);
        options.inPreferredConfig = Bitmap.Config.ARGB_8888;

        Log.i(TAG, "sampleSize = " + sampleSize + " , " + "options.inSampleSize = " + options.inSampleSize);
        bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, options);//!!!!溢出
    } catch (Exception e) {
        Log.e(TAG,   e.getMessage());
    } finally {
    	data = null;
    }

    // Ensure bitmap in 8888 format, good for editing as well as GL compatible.
    if ((bitmap != null) && (bitmap.getConfig() != Bitmap.Config.ARGB_8888)) {
        Bitmap copy = bitmap.copy(Bitmap.Config.ARGB_8888, true);
        bitmap.recycle();
        bitmap = copy;
    }

    if (bitmap != null) {
        // Scale down the sampled bitmap if it's still larger than the desired dimension.
        float scale = Math.min((float) width / bitmap.getWidth(),
                (float) height / bitmap.getHeight());
        scale = Math.max(scale, Math.min((float) height / bitmap.getWidth(),
                (float) width / bitmap.getHeight()));
        if (scale < 1) {
            Matrix m = new Matrix();
            m.setScale(scale, scale);
            Bitmap transformed = createBitmap(
                    bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m);
            bitmap.recycle();
            return transformed;
        }
    }
    return bitmap;
}
 
Example 19
Project: android-titanium-imagecropper   File: BitmapUtils.java   View Source Code Vote up 4 votes
/**
 * Crop image bitmap from given bitmap using the given points in the original bitmap and the given
 * rotation.<br>
 * if the rotation is not 0,90,180 or 270 degrees then we must first crop a larger area of the
 * image that contains the requires rectangle, rotate and then crop again a sub rectangle.
 *
 * @param scale how much to scale the cropped image part, use 0.5 to lower the image by half (OOM
 *     handling)
 */
private static Bitmap cropBitmapObjectWithScale(
    Bitmap bitmap,
    float[] points,
    int degreesRotated,
    boolean fixAspectRatio,
    int aspectRatioX,
    int aspectRatioY,
    float scale,
    boolean flipHorizontally,
    boolean flipVertically) {

  // get the rectangle in original image that contains the required cropped area (larger for non
  // rectangular crop)
  Rect rect =
      getRectFromPoints(
          points,
          bitmap.getWidth(),
          bitmap.getHeight(),
          fixAspectRatio,
          aspectRatioX,
          aspectRatioY);

  // crop and rotate the cropped image in one operation
  Matrix matrix = new Matrix();
  matrix.setRotate(degreesRotated, bitmap.getWidth() / 2, bitmap.getHeight() / 2);
  matrix.postScale(flipHorizontally ? -scale : scale, flipVertically ? -scale : scale);
  Bitmap result =
      Bitmap.createBitmap(bitmap, rect.left, rect.top, rect.width(), rect.height(), matrix, true);

  if (result == bitmap) {
    // corner case when all bitmap is selected, no worth optimizing for it
    result = bitmap.copy(bitmap.getConfig(), false);
  }

  // rotating by 0, 90, 180 or 270 degrees doesn't require extra cropping
  if (degreesRotated % 90 != 0) {

    // extra crop because non rectangular crop cannot be done directly on the image without
    // rotating first
    result =
        cropForRotatedImage(
            result, points, rect, degreesRotated, fixAspectRatio, aspectRatioX, aspectRatioY);
  }

  return result;
}
 
Example 20
Project: ultrasonic   File: FileUtil.java   View Source Code Vote up 4 votes
public static Bitmap getAlbumArtBitmap(Context context, MusicDirectory.Entry entry, int size, boolean highQuality)
{
	if (entry == null) return null;

	File albumArtFile = getAlbumArtFile(context, entry);

	SubsonicTabActivity subsonicTabActivity = SubsonicTabActivity.getInstance();
	Bitmap bitmap = null;
	ImageLoader imageLoader = null;

	if (subsonicTabActivity != null)
	{
		imageLoader = subsonicTabActivity.getImageLoader();

		if (imageLoader != null)
		{
			bitmap = imageLoader.getImageBitmap(entry, true, size);
		}
	}

	if (bitmap != null)
	{
		return bitmap.copy(bitmap.getConfig(), false);
	}

	if (albumArtFile != null && albumArtFile.exists())
	{
		final BitmapFactory.Options opt = new BitmapFactory.Options();

		if (size > 0)
		{
			opt.inJustDecodeBounds = true;
			BitmapFactory.decodeFile(albumArtFile.getPath(), opt);

			if (highQuality)
			{
				opt.inDither = true;
				opt.inPreferQualityOverSpeed = true;
			}

			opt.inPurgeable = true;
			opt.inSampleSize = Util.calculateInSampleSize(opt, size, Util.getScaledHeight(opt.outHeight, opt.outWidth, size));
			opt.inJustDecodeBounds = false;
		}

		try
		{
			bitmap = BitmapFactory.decodeFile(albumArtFile.getPath(), opt);
		}
		catch (Exception ex)
		{
			Log.e(TAG, "Exception in BitmapFactory.decodeFile()", ex);
		}

		Log.i("getAlbumArtBitmap", String.valueOf(size));

		if (bitmap != null)
		{
			if (imageLoader != null)
			{
				imageLoader.addImageToCache(bitmap, entry, size);
			}
		}

		return bitmap == null ? null : bitmap;
	}

	return null;
}