android-image

Crop saved Image using com.android.camera.action.CROP on android

瘦欲@ 提交于 2019-11-29 15:22:20
I have reads many question about this, but I still failed using this code... maybe anyone can corect my code... I want to crop an image from file that i know the location using com.android.camera.action.CROP like this... mImageCaptureUri = Uri.fromFile(f); Intent intent = new Intent("com.android.camera.action.CROP"); intent.setType("image/*"); intent.setData(mImageCaptureUri); intent.putExtra("crop", true); intent.putExtra("outputX", 200); intent.putExtra("outputY", 200); intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); intent.putExtra("scale", true); intent.putExtra("return-data"

Get images from PHP server to Android

柔情痞子 提交于 2019-11-29 15:04:21
问题 I am prototyping an android application and need to get images from a web server to Android ListView. I understand the android side of things (although am yet to implement and test) via this thread Lazy load of images in ListView I need help with the PHP/server side of it. The particular images that need to be populated in a list view will be decided dynamically (those images that have a given tag). I am new to web applications but have managed to set up a web server which can run PHP scripts

How to choose an image resolution to be shown fullscreen?

独自空忆成欢 提交于 2019-11-29 12:50:32
I have an image which is actually 393 x 21 px, which I would like to set on the bottom of my View. The problem is that, even if i set the width and the height to fill_parent, my image stays very small in the middle of the screen bottom and on the left and the right I have an empty field. I can resolve this by reducing the Image width size mannualy but is ther any other solution whic could set the image in fullscreen ? Thank you. //in your xml Image attribute as android:scaleType="fitXY" or //using thru programatically imgview.setScaleType(ScaleType.FIT_XY); 来源: https://stackoverflow.com

How To Convert A Bitmap Image To Uri

僤鯓⒐⒋嵵緔 提交于 2019-11-29 11:56:42
I have not found the answer to this question anywhere. The Bitmap Image is processed in The application, meaning there is no File path to get the Image. Below is how to convert a Uri to Bitmap if (requestCode == RC_PHOTO_PICKER && resultCode == RESULT_OK) { Uri selectedImageUri = data.getData(); imageview.setImageURI(selectedImageUri); try { bitmap1 = MediaStore.Images.Media.getBitmap(this.getContentResolver(), selectedImageUri); } catch (IOException e) { e.printStackTrace(); Toast.makeText(this, "" + e, Toast.LENGTH_SHORT).show(); } bitmap1.compress(Bitmap.CompressFormat.JPEG, 7,

Implementing a multicolumn ListView with independent Row-heights

蓝咒 提交于 2019-11-29 10:01:53
问题 I would like to create a list of about 200 ImageViews (random heights) with the following layout in a 'collage' fashion: Normally I would do this in a ListView for the peformance gained by using Adapters but since i want the images to be displayed in columns, and with different height (See picture Example ) depending on the pictures, I cannot use a single listview for this purpose. I have tried implementing this layout with: Three ListViews with synchronized scrolling = Slow Single ListView

decodeStream returns null

三世轮回 提交于 2019-11-29 08:23:48
I'm trying to adopt bitmap resizing tutorial - the only difference is that I use decodeStream instead of decodeResource. It's strange but decodeStream, without any manipulations, gives me a bitmap obj, but when I go through decodeSampledBitmapFromStream it returns null for some reason. How do I fix it ? Here's the code I use: protected Handler _onPromoBlocksLoad = new Handler() { @Override public void dispatchMessage(Message msg) { PromoBlocksContainer c = (PromoBlocksContainer) _promoBlocksFactory.getResponse(); HttpRequest request = new HttpRequest(c.getPromoBlocks().get(0).getSmallThumbnail

Crop Image as circle in Android

萝らか妹 提交于 2019-11-29 04:32:42
Does anyone know how to crop an image\bitmap to a circle? I can not find any solution, sorry .. For having rounded corners for ImageView, convert your image into bitmap and then try following code : private Bitmap getRoundedCroppedBitmap(Bitmap bitmap) { int widthLight = bitmap.getWidth(); int heightLight = bitmap.getHeight(); Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(),Config.ARGB_8888); Canvas canvas = new Canvas(output); Paint paintColor = new Paint(); paintColor.setFlags(Paint.ANTI_ALIAS_FLAG); RectF rectF = new RectF(new Rect(0, 0, widthLight, heightLight));

Correspondence between ImageView coordinates and Bitmap Pixels - Android

為{幸葍}努か 提交于 2019-11-29 02:48:37
问题 In my application I want the user to be able to select some content of an Image contained inside an ImageView . To select the content I subclassed the ImageView class making it implement the OnTouchListener so to draw over it a rectangle with borders decided by the user. Here is an example of the result of the drawing (to have an idea of how it works you can think of it as when you click with the mouse on your desktop and drag the mouse): Now I need to determine which pixels of the Bitmap

Loading large images without OutOfMemoryError

为君一笑 提交于 2019-11-29 01:25:53
I have a 5000 x 4000 px image which I want to draw onto a canvas. First I tried to load it from resources. I put it in /res/drawable . I used the following method: InputStream input = getResources().openRawResource(R.drawable.huge_image); Drawable d = Drawable.createFromStream(input, "image"); d.setBounds(...); d.draw(canvas); It worked like a charm. In this case the InputStream is an AssetManager.AssetInputStream . So now I want to load it from the sdcard. Here's what I tried to do: File f = new File(path); Uri uri = Uri.fromFile(f); InputStream input = mContext.getContentResolver()

How to get a Bitmap from a raw image

若如初见. 提交于 2019-11-29 00:09:04
I am reading a raw image from the network. This image has been read by an image sensor, not from a file. These are the things I know about the image: ~ Height & Width ~ Total size (in bytes) ~ 8-bit grayscale ~ 1 byte/pixel I'm trying to convert this image to a bitmap to display in an imageview. Here's what I tried: BitmapFactory.Options opt = new BitmapFactory.Options(); opt.outHeight = shortHeight; //360 opt.outWidth = shortWidth;//248 imageBitmap = BitmapFactory.decodeByteArray(imageArray, 0, imageSize, opt); decodeByteArray returns null , since it cannot decode my image. I also tried