android-bitmap

How to make Picasso load images faster?

雨燕双飞 提交于 2020-01-23 03:33:26
问题 I use Picasso (image downloading library for Android). Picasso website I charge my image like this: Picasso.get().load("http://i.imgur.com/myImage.png").into(imageView); But, if myImage.png is too big, the download become slow. (With bad internet connection of course) How to make Picasso load images faster? Can I just make the quality lower by Picasso? Or can I charge them "early" a few seconds before using them? Note that I cannot touch the file myImage.png --------------------- EDIT Any

Create a bitmap using double values instead of int Android

不羁岁月 提交于 2020-01-17 04:42:11
问题 In my code I need create a Bitmap using double values. It´s important use the correct value. I´m using: Bitmap bmp = Bitmap.createBitmap(int, int, Bitmap.Config.ARGB_8888); ... When i would need something like: Bitmap bmp = Bitmap.createBitmap(double, double, Bitmap.Config.ARGB_8888); Everything I've trying to make the conversion ( possible ? ) Only returns the initial value or integer How I can use double values ​​when creating the bitmap? 回答1: Perhaps I misunderstand the question, but

How to make Picasso/Glide work with Html.ImageGetter for caching images?

泄露秘密 提交于 2020-01-13 14:00:28
问题 Thanks for all the effort @Budius has made. Most part of image work of my app could be handled by Picasso/Glide, however, some images are displayed in a TextView by Html.fromHtml . And the images in TextView are also used frequently. However, I don't know how to implement getDrawable() method with Picasso/Glide for the ImageGetter passed to Html.fromHtml . Is it possible to share the same cache of Picasso/Glide for these pictures in TextView and other bitmaps? Or should I use an custom

Gray out fragment in background

人走茶凉 提交于 2020-01-13 06:31:26
问题 I have one main Fragment which is in the background when the second Fragment gets called with getFragmentManager().beginTransaction().add . Right now the user can see the main Fragment behind the second Fragment like it should be. But i want it to be like in a grayed look. When the Second Fragment gets called, the main Fragment should gray out. Im not sure what to google (have tried a lot of keywords) to describe this. My idea was to take a screenshot of the main fragment (bitmap) and make it

How can I save my bitmap correctly for second time?

北城以北 提交于 2020-01-11 05:22:32
问题 I want to save my bitmap to cache directory. I use this code: try { File file_d = new File(dir+"screenshot.jpg"); @SuppressWarnings("unused") boolean deleted = file_d.delete(); } catch (Exception e) { // TODO: handle exception } imagePath = new File(dir+"screenshot.jpg"); FileOutputStream fos; try { fos = new FileOutputStream(imagePath); bitmap.compress(CompressFormat.JPEG, 100, fos); fos.flush(); fos.close(); } catch (FileNotFoundException e) { Log.e("GREC", e.getMessage(), e); } catch

How to centerCrop an image Programatically by maintaining Aspect ratio like centerCrop do in XML?

六月ゝ 毕业季﹏ 提交于 2020-01-07 08:47:11
问题 How to centerCrop an image like the same method "centerCrop" do in xml android ? I don't want to crop the center of the image .I have tried the below code but ,it was cropping the center portion of the image,and it produce a square shaped image,I want the same centerCrop function to use in a Canvas on android.Can anyone help?? Hope my question is clear to you. Bitmap bitmap=BitmapFactory.decodeResource(res, (R.drawable.ice)); Bitmap cropBmp; if (bitmap.getWidth() >= bitmap.getHeight()){

How to convert Bitmap into Base64 String without compressing? [duplicate]

[亡魂溺海] 提交于 2020-01-06 06:17:06
问题 This question already has an answer here : How to convert a image into Base64 string without compressing the image? (1 answer) Closed 8 months ago . I am trying to convert a bitmap image into base64 String using this code. I and getting a very low-quality image. How can I get a good quality image after convert bitmap into Base64 Sring public String BitMapToString(Bitmap bitmap) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);

Why is my BitmapFactory.decodeByteArray returning null?

半世苍凉 提交于 2020-01-06 03:09:04
问题 I am trying to convert an image stored in Database in Base64 format, to a Bitmap to be used in an Imageview. So, I store it in SQLite this way: Bitmap imageBitmap = (Bitmap) extras.get("data"); ByteArrayOutputStream stream = new ByteArrayOutputStream(); Bitmap fotoGrande=(Bitmap) extras.get("data"); imageBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out); //I am adding some data to EXIF here, add to an static ArrayList<Bitmap> in other class and I store it this way: int bytes=listaFotos

Android Crop Bitmap Canvas

与世无争的帅哥 提交于 2020-01-06 03:08:35
问题 I want to create the crop bitmap functionality and have referred Android: Free Croping of Image but this sets the bitmap in another imageView.Now I know I can set the cropped bitmap in the canvas but I want to retain the original bitmap and want to do the cropping in onDraw() and not make a different bitmap and then set it in canvas.I have tried to implement the below code in onDraw but there is no cropping and bitmap remains as it is.Pleas help so that I can code this in onDraw() method of

Android Crop Bitmap Canvas

淺唱寂寞╮ 提交于 2020-01-06 03:07:20
问题 I want to create the crop bitmap functionality and have referred Android: Free Croping of Image but this sets the bitmap in another imageView.Now I know I can set the cropped bitmap in the canvas but I want to retain the original bitmap and want to do the cropping in onDraw() and not make a different bitmap and then set it in canvas.I have tried to implement the below code in onDraw but there is no cropping and bitmap remains as it is.Pleas help so that I can code this in onDraw() method of