from: http://www.codota.com/android/methods/android.graphics.Bitmap/compress
Best code examples for Bitmap compress method (android.graphics.Bitmap.compress)
These code examples were ranked by Codota’s semantic indexing as the best open source examples forBitmap compress method.
You can now enable Codota on your own code to easily search and navigate your Java codebase.
Bitmap compress examples from Open Source projects
This code example shows how to use the following methods: compress
62: b.compress(Bitmap.CompressFormat.PNG, 100, out);
Full Snippet Info
This code example shows how to use the following methods: compress
56: boolean didCompress = data.compress(compressFormat, quality, out);
Full Snippet Info
This code example shows how to use the following methods: compress, createBitmap, getHeight, getWidth
46: int width = bitmap.getWidth();
-
52: int height = (int)((float)bitmap.getHeight() * ratio);
53: bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height);
-
57: bitmap.compress(format, 100, stream);
Full Snippet Info
This code example shows how to use the following methods: compress, recycle
251: if (image.compress(CompressFormat.JPEG, (int)(compressionQuality * 100), bos)) {
-
265: image.recycle();
Full Snippet Info
This code example shows how to use the following methods: compress
72: b.compress(Bitmap.CompressFormat.PNG, 100, out);
Full Snippet Info
This code example shows how to use the following methods: compress, getHeight, getWidth
125: final int size = photo.getWidth() * photo.getHeight() * 4;
-
129: photo.compress(Bitmap.CompressFormat.PNG, 100, out);
Full Snippet Info
This code example shows how to use the following methods: compress
34: image.compress(Bitmap.CompressFormat.PNG, 90, fos);
Full Snippet Info
This code example shows how to use the following methods: compress
57: val.compress(CompressFormat.PNG, 0, baos);
Full Snippet Info
This code example shows how to use the following methods: compress, getHeight, getWidth
249: final boolean compressed = b.compress(Bitmap.CompressFormat.JPEG, quality, baos);
-
288: (mDisplayPhoto.getWidth() > mThumbnailPhoto.getWidth() ||
289: mDisplayPhoto.getHeight() > mThumbnailPhoto.getHeight());
Full Snippet Info
This code example shows how to use the following methods: compress, getHeight, getWidth
146: info.setHeight(bmp.getHeight());
147: info.setWidth(bmp.getWidth());
-
164: if (bitmap.compress(format, quality, bos))
Full Snippet Info
This code example shows how to use the following methods: compress, getHeight, getWidth
128: int size = bitmap.getWidth() * bitmap.getHeight() * 4;
-
130: bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
Full Snippet Info
This code example shows how to use the following methods: compress
110: bitmap.compress(CompressFormat.PNG, 100, ostream);
Full Snippet Info
This code example shows how to use the following methods: compress, recycle
188: bitmap.compress(Bitmap.CompressFormat.JPEG, 75, byteArray);
189: bitmap.recycle();
Full Snippet Info
This code example shows how to use the following methods: compress, getHeight, getWidth
107: final int size = bitmap.getWidth() * bitmap.getHeight() * 4;
-
110: bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
Full Snippet Info
This code example shows how to use the following methods: compress, isRecycled, recycle
55: if (bitmap != null && !bitmap.isRecycled()) {
-
59: bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bos);
-
67: bitmap.recycle();
Full Snippet Info
This code example shows how to use the following methods: compress, createBitmap, getHeight, getWidth
174: bitmap.compress(CompressFormat.JPEG, 85, new FileOutputStream(thumbNail));
-
188: return Bitmap.createBitmap(image, 0, 0,
189: image.getWidth(), image.getHeight(),
Full Snippet Info
This code example shows how to use the following methods: compress
59: b.compress(Bitmap.CompressFormat.PNG, 100, out);
Full Snippet Info
This code example shows how to use the following methods: compress
71: bitmap.compress(CompressFormat.JPEG, quality, stream);
Full Snippet Info
This code example shows how to use the following methods: compress
42: bitmap.compress(Bitmap.CompressFormat.PNG, 90, fOut);
Full Snippet Info
This code example shows how to use the following methods: compress, getHeight, getWidth
143: int size = bitmap.getWidth() * bitmap.getHeight() * 4;
-
146: bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
Full Snippet Info
This code example shows how to use the following methods: compress, insertImage
56: b.compress(Bitmap.CompressFormat.PNG, 80, fos);
-
59: MediaStore.Images.Media.insertImage(cr, b, "Screen", "screen");
Full Snippet Info
This code example shows how to use the following methods: compress
62: b.compress(Bitmap.CompressFormat.PNG, 100, out);
Full Snippet Info
This code example shows how to use the following methods: compress, close, toByteArray
14: ByteArrayOutputStream stream = new ByteArrayOutputStream();
15: bm.getBitmap().compress(Bitmap.CompressFormat.JPEG, 100, stream);
16: byte[] byteArray = stream.toByteArray();
17: stream.close();
Full Snippet Info
This code example shows how to use the following methods: compress
453: image.compress(Bitmap.CompressFormat.PNG, 100, outStream);
Full Snippet Info
This code example shows how to use the following methods: compress, getHeight, getWidth, hasAlpha
139: if (image.hasAlpha()) {
140: if (image.compress(CompressFormat.PNG, 100, bos)) {
-
145: if (image.compress(CompressFormat.JPEG, 100, bos)) {
-
152: blob.width = image.getWidth();
153: blob.height = image.getHeight();
Full Snippet Info
This code example shows how to use the following methods: compress, getHeight, getWidth
121: int size = bitmap.getWidth() * bitmap.getHeight() * 4;
-
123: bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
Full Snippet Info
This code example shows how to use the following methods: compress, close
196: FileOutputStream fileOutputStream = new FileOutputStream(imageFile);
-
198: outputSize, false).compress(CompressFormat.JPEG, 100,
-
200: fileOutputStream.close();
Full Snippet Info
This code example shows how to use the following methods: compress, getHeight, getWidth
118: int size = bitmap.getWidth() * bitmap.getHeight() * 4;
-
121: bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
Full Snippet Info
This code example shows how to use the following methods: compress
261: if (!bmp.compress(CompressFormat.PNG, 100, fout)) {
Full Snippet Info
This code example shows how to use the following methods: compress, getHeight, getWidth
88: int size = bitmap.getWidth() * bitmap.getHeight() * 2;
-
91: bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
Full Snippet Info
This code example shows how to use the following methods: compress, recycle
424: rotated.compress(getCompressFormat(dest), 100, fileOutputStream);
-
443: rotated.recycle();
Full Snippet Info
This code example shows how to use the following methods: compress, toByteArray
31: ByteArrayOutputStream baops = new ByteArrayOutputStream();
32: bitmap.getBitmap().compress(CompressFormat.PNG, 100, baops);
-
34: return baops.toByteArray();
Full Snippet Info
This code example shows how to use the following methods: compress, getHeight, getWidth
182: int size = bitmap.getWidth() * bitmap.getHeight() * 4;
-
185: bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
Full Snippet Info
This code example shows how to use the following methods: toString
41: public static final String IMAGE_PNG_EXTENSION = IMAGE_PNG_FORMAT.toString().toLowerCase();
Full Snippet Info
This code example shows how to use the following methods: name
43: setContentType("image/" + compressFormat.name().toLowerCase(Locale.US));
Full Snippet Info
This code example shows how to use the following methods: name
53: + compressedImageFormat.name();
Full Snippet Info
This code example shows how to use the following methods: toString
42: photoType = CompressFormat.JPEG.toString().toLowerCase();
Full Snippet Info
This code example shows how to use the following methods: name
53: + compressedImageFormat.name();
Full Snippet Info
This code example shows how to use the following methods: name
196: + compressedImageFormat.name();
Full Snippet Info
This code example shows how to use the following methods: name
91: return Integer.toHexString(imageUrl.hashCode()) + "." + compressedImageFormat.name();
Full Snippet Info
This code example shows how to use the following methods: name
51: intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.name());
Full Snippet Info
Related Bitmap compress Questions & Answers:
compress Method Overview
Write a compressed version of the bitmap to the specified outputstream.
See Also
- copy
Tries to make a new bitmap based on the dimensions of this bitmap, setting the new bitmap's config to the one specified, and then copying this bitmap's pixels into the new bitmap.
- copyPixelsFromBuffer
Copy the pixels from the buffer, beginning at the current position, overwriting the bitmap's pixels.
- copyPixelsToBuffer
Copy the bitmap's pixels into the specified buffer (allocated by the caller).
- createBitmap
Returns a immutable bitmap with the specified width and height, with each pixel value set to the corresponding value in the colors array.
- createScaledBitmap
Creates a new bitmap, scaled from an existing bitmap, when possible.
- eraseColor
Fills the bitmap's pixels with the specified Color.
- extractAlpha
Returns a new bitmap that captures the alpha values of the original.
- getByteCount
Returns the minimum number of bytes that can be used to store this bitmap's pixels.
- getConfig
If the bitmap's internal config is in one of the public formats, return that config, otherwise return null.
- getDensity
Returns the density for this bitmap.
- getHeight
Returns the bitmap's height
- getPixels
Returns in pixels[] a copy of the data in the bitmap.
- getRowBytes
Return the number of bytes between rows in the bitmap's pixels.
- getWidth
Returns the bitmap's width
- hasAlpha
Returns true if the bitmap's config supports per-pixel alpha, and if the pixels may contain non-opaque alpha values.
- isMutable
Returns true if the bitmap is marked as mutable (i.e. can be drawn into)
- isRecycled
Returns true if this bitmap has been recycled.
- recycle
Free the native object associated with this bitmap, and clear the reference to the pixel data.
- writeToParcel
Write the bitmap and its pixels to the parcel.
Popular Android Classes
- Fragment
(android.app.Fragment)
- GridView
(android.widget.GridView)
- Handler
(android.os.Handler)
- ImageView
(android.widget.ImageView)
- Intent
(android.content.Intent)
- ListView
(android.widget.ListView)
- MediaPlayer
(android.media.MediaPlayer)
- SQLiteDatabase
(android.database.sqlite.SQLiteDatabase)
- ScrollView
(android.widget.ScrollView)
- Service
(android.app.Service)
- Spinner
(android.widget.Spinner)
- TextView
(android.widget.TextView)
- Toast
(android.widget.Toast)
- WebView
(android.webkit.WebView)