congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Bitmap.getPixels
Code IndexAdd Tabnine to your IDE (free)

How to use
getPixels
method
in
android.graphics.Bitmap

Best Java code snippets using android.graphics.Bitmap.getPixels (Showing top 20 results out of 1,476)

Refine searchRefine arrow

  • Bitmap.getWidth
  • Bitmap.getHeight
  • Common ways to obtain Bitmap
private void myMethod () {
Bitmap b =
  • Codota IconString pathName;BitmapFactory.decodeFile(pathName)
  • Smart code suggestions by Tabnine
}
origin: CarGuo/GSYVideoPlayer

protected int[] getImageData(Bitmap img) {
  int w = img.getWidth();
  int h = img.getHeight();
  int[] data = new int[w * h];
  img.getPixels(data, 0, w, 0, 0, w, h);
  return data;
}
origin: bumptech/glide

int w = image.getWidth();
int h = image.getHeight();
image.getPixels(pixelsInt, 0, w, 0, 0, w, h);
origin: stackoverflow.com

 private Bitmap RGB565toARGB888(Bitmap img) {
  int numPixels = img.getWidth()* img.getHeight();
  int[] pixels = new int[numPixels];

  //Get JPEG pixels.  Each int is the color values for one pixel.
  img.getPixels(pixels, 0, img.getWidth(), 0, 0, img.getWidth(), img.getHeight());

  //Create a Bitmap of the appropriate format.
  Bitmap result = Bitmap.createBitmap(img.getWidth(), img.getHeight(), Bitmap.Config.ARGB_8888);

  //Set RGB pixels.
  result.setPixels(pixels, 0, result.getWidth(), 0, 0, result.getWidth(), result.getHeight());
  return result;
}
origin: Zomato/AndroidPhotoFilters

public static Bitmap doBrightness(int value, Bitmap inputImage) {
  int width = inputImage.getWidth();
  int height = inputImage.getHeight();
  int[] pixels = new int[width * height];
  inputImage.getPixels(pixels, 0, width, 0, 0, width, height);
  NativeImageProcessor.doBrightness(pixels, value, width, height);
  inputImage.setPixels(pixels, 0, width, 0, 0, width, height);
  return inputImage;
}
origin: Zomato/AndroidPhotoFilters

public static Bitmap doSaturation(Bitmap inputImage, float level) {
  int width = inputImage.getWidth();
  int height = inputImage.getHeight();
  int[] pixels = new int[width * height];
  inputImage.getPixels(pixels, 0, width, 0, 0, width, height);
  NativeImageProcessor.doSaturation(pixels, level, width, height);
  inputImage.setPixels(pixels, 0, width, 0, 0, width, height);
  return inputImage;
}
origin: Zomato/AndroidPhotoFilters

public static Bitmap doContrast(float value, Bitmap inputImage) {
  int width = inputImage.getWidth();
  int height = inputImage.getHeight();
  int[] pixels = new int[width * height];
  inputImage.getPixels(pixels, 0, width, 0, 0, width, height);
  NativeImageProcessor.doContrast(pixels, value, width, height);
  inputImage.setPixels(pixels, 0, width, 0, 0, width, height);
  return inputImage;
}
origin: Zomato/AndroidPhotoFilters

public static Bitmap doColorOverlay(int depth, float red, float green, float blue, Bitmap inputImage) {
  int width = inputImage.getWidth();
  int height = inputImage.getHeight();
  int[] pixels = new int[width * height];
  inputImage.getPixels(pixels, 0, width, 0, 0, width, height);
  NativeImageProcessor.doColorOverlay(pixels, depth, red, green, blue, width, height);
  inputImage.setPixels(pixels, 0, width, 0, 0, width, height);
  return inputImage;
}
origin: chentao0707/SimplifyReader

public static Bitmap doBlurJniArray(Bitmap sentBitmap, int radius, boolean canReuseInBitmap) {
  Bitmap bitmap;
  if (canReuseInBitmap) {
    bitmap = sentBitmap;
  } else {
    bitmap = sentBitmap.copy(sentBitmap.getConfig(), true);
  }
  if (radius < 1) {
    return (null);
  }
  int w = bitmap.getWidth();
  int h = bitmap.getHeight();
  int[] pix = new int[w * h];
  bitmap.getPixels(pix, 0, w, 0, 0, w, h);
  // Jni array calculate
  ImageBlur.blurIntArray(pix, w, h, radius);
  bitmap.setPixels(pix, 0, w, 0, 0, w, h);
  return (bitmap);
}
origin: yipianfengye/android-zxingLibrary

public BitmapLuminanceSource(Bitmap bitmap) {
  super(bitmap.getWidth(), bitmap.getHeight());
  // 首先,要取得该图片的像素数组内容
  int[] data = new int[bitmap.getWidth() * bitmap.getHeight()];
  this.bitmapPixels = new byte[bitmap.getWidth() * bitmap.getHeight()];
  bitmap.getPixels(data, 0, getWidth(), 0, 0, getWidth(), getHeight());
  // 将int数组转换为byte数组,也就是取像素值中蓝色值部分作为辨析内容
  for (int i = 0; i < data.length; i++) {
    this.bitmapPixels[i] = (byte) data[i];
  }
}
origin: TheFinestArtist/FinestWebView-Android

public static Bitmap getColoredBitmap(@NonNull Bitmap bitmap, @ColorInt int color) {
 int alpha = Color.alpha(color);
 int red = Color.red(color);
 int green = Color.green(color);
 int blue = Color.blue(color);
 int[] pixels = new int[bitmap.getWidth() * bitmap.getHeight()];
 bitmap.getPixels(pixels, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight());
 for (int i = 0; i < pixels.length; i++) {
  int pixel = pixels[i];
  int pixelAlpha = Color.alpha(pixel);
  if (pixelAlpha != 0) {
   pixels[i] = Color.argb((int) (pixelAlpha * alpha / 256f), red, green, blue);
  }
 }
 Bitmap coloredBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
 coloredBitmap.setPixels(pixels, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(),
   bitmap.getHeight());
 return coloredBitmap;
}
origin: TheFinestArtist/FinestWebView-Android

 public static Bitmap getGradientBitmap(int width, int height, @ColorInt int color) {
  Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);

  int alpha = Color.alpha(color);
  int red = Color.red(color);
  int green = Color.green(color);
  int blue = Color.blue(color);

  int[] pixels = new int[width * height];
  bitmap.getPixels(pixels, 0, width, 0, 0, width, height);
  for (int y = 0; y < height; y++) {
   int gradientAlpha = (int) ((float) alpha * (float) (height - y) * (float) (height - y)
     / (float) height
     / (float) height);
   for (int x = 0; x < width; x++) {
    pixels[x + y * width] = Color.argb(gradientAlpha, red, green, blue);
   }
  }

  bitmap.setPixels(pixels, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight());
  return bitmap;
 }
}
origin: stackoverflow.com

int w = defaultBitmap.getWidth();
int h = defaultBitmap.getHeight();
defaultBitmap.getPixels(pix, 0, w, 0, 0, w, h);
origin: stackoverflow.com

int width = Math.round(sentBitmap.getWidth() * scale);
int height = Math.round(sentBitmap.getHeight() * scale);
sentBitmap = Bitmap.createScaledBitmap(sentBitmap, width, height, false);
int w = bitmap.getWidth();
int h = bitmap.getHeight();
bitmap.getPixels(pix, 0, w, 0, 0, w, h);
origin: Zomato/AndroidPhotoFilters

public static Bitmap applyCurves(int[] rgb, int[] red, int[] green, int[] blue, Bitmap inputImage) {
  // create output bitmap
  Bitmap outputImage = inputImage;
  // get image size
  int width = inputImage.getWidth();
  int height = inputImage.getHeight();
  int[] pixels = new int[width * height];
  outputImage.getPixels(pixels, 0, width, 0, 0, width, height);
  if (rgb != null) {
    pixels = NativeImageProcessor.applyRGBCurve(pixels, rgb, width, height);
  }
  if (!(red == null && green == null && blue == null)) {
    pixels = NativeImageProcessor.applyChannelCurves(pixels, red, green, blue, width, height);
  }
  try {
    outputImage.setPixels(pixels, 0, width, 0, 0, width, height);
  } catch (IllegalStateException ise) {
  }
  return outputImage;
}
origin: ZieIony/Carbon

private static void blurSoftware(Bitmap bitmap, float radius) {
  int width = bitmap.getWidth();
  int height = bitmap.getHeight();
  int[] pixels = new int[width * height];
  bitmap.getPixels(pixels, 0, width, 0, 0, width, height);
  int[] halfResult = new int[width * height];
  int rad = (int) Math.ceil(radius);
origin: stackoverflow.com

    smallBitmap.getWidth(), smallBitmap.getHeight(),
    Bitmap.Config.ARGB_8888);
int numPixels = img.getWidth() * img.getHeight();
int[] pixels = new int[numPixels];
img.getPixels(pixels, 0, img.getWidth(), 0, 0, img.getWidth(), img.getHeight());
origin: JessYanCoding/MVPArms

int w = bitmap.getWidth();
int h = bitmap.getHeight();
bitmap.getPixels(pix, 0, w, 0, 0, w, h);
origin: wasabeef/glide-transformations

int w = bitmap.getWidth();
int h = bitmap.getHeight();
bitmap.getPixels(pix, 0, w, 0, 0, w, h);
origin: qiujuer/Genius-Android

} else if (i == 2) {
  int w = overlay.getWidth();
  int h = overlay.getHeight();
  int[] pix = new int[w * h];
  overlay.getPixels(pix, 0, w, 0, 0, w, h);
origin: chentao0707/SimplifyReader

int w = bitmap.getWidth();
int h = bitmap.getHeight();
bitmap.getPixels(pix, 0, w, 0, 0, w, h);
android.graphicsBitmapgetPixels

Popular methods of Bitmap

  • createBitmap
  • getHeight
  • getWidth
  • recycle
  • compress
  • createScaledBitmap
  • isRecycled
  • getConfig
  • copy
  • setPixels
  • getPixel
  • eraseColor
  • getPixel,
  • eraseColor,
  • getRowBytes,
  • getByteCount,
  • copyPixelsFromBuffer,
  • setPixel,
  • isMutable,
  • getAllocationByteCount,
  • getDensity

Popular in Java

  • Updating database using SQL prepared statement
  • setContentView (Activity)
  • getContentResolver (Context)
  • runOnUiThread (Activity)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • JTable (javax.swing)
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now