Resize images with Glide in a ImageView Android









up vote
3
down vote

favorite
1












I have a lot of doubts about the treatment of the images in android, and I was hoping to see if you could solve them.



At this point I have an image that occupies 320 dp high, and match_parent width, which is around 60% of the screen.
This image of the load with Glide, of some images in 1080 that I have personally.



I tried to make centroCrop and fitXY, but always deform the images. The first type I know cuts the image, but the second one fits a size, but it does deform the image high or wide.



Is there any way, to insert it with Glide and see it as it is?
What properties have I to touch on ImageView and which of Glide?



 <ImageView
android:id="@+id/img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false"
app:layout_collapseMode="parallax"
android:scaleType="fitXY"
app:layout_scrollFlags="scroll|enterAlways" />


Thanks in advance.










share|improve this question





















  • Use .override(w,h) for it.
    – Piyush
    Sep 8 '17 at 10:41










  • And I have a image with no 1080? For example with an user. They have images with diferents sizes.
    – Traif
    Sep 8 '17 at 10:51










  • @Traif check custom transformation with Glide.
    – Raghunandan
    Sep 8 '17 at 10:56










  • Not understand.. what is your problem if you override(w,h)??
    – Ranjith Kumar
    Sep 8 '17 at 11:03














up vote
3
down vote

favorite
1












I have a lot of doubts about the treatment of the images in android, and I was hoping to see if you could solve them.



At this point I have an image that occupies 320 dp high, and match_parent width, which is around 60% of the screen.
This image of the load with Glide, of some images in 1080 that I have personally.



I tried to make centroCrop and fitXY, but always deform the images. The first type I know cuts the image, but the second one fits a size, but it does deform the image high or wide.



Is there any way, to insert it with Glide and see it as it is?
What properties have I to touch on ImageView and which of Glide?



 <ImageView
android:id="@+id/img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false"
app:layout_collapseMode="parallax"
android:scaleType="fitXY"
app:layout_scrollFlags="scroll|enterAlways" />


Thanks in advance.










share|improve this question





















  • Use .override(w,h) for it.
    – Piyush
    Sep 8 '17 at 10:41










  • And I have a image with no 1080? For example with an user. They have images with diferents sizes.
    – Traif
    Sep 8 '17 at 10:51










  • @Traif check custom transformation with Glide.
    – Raghunandan
    Sep 8 '17 at 10:56










  • Not understand.. what is your problem if you override(w,h)??
    – Ranjith Kumar
    Sep 8 '17 at 11:03












up vote
3
down vote

favorite
1









up vote
3
down vote

favorite
1






1





I have a lot of doubts about the treatment of the images in android, and I was hoping to see if you could solve them.



At this point I have an image that occupies 320 dp high, and match_parent width, which is around 60% of the screen.
This image of the load with Glide, of some images in 1080 that I have personally.



I tried to make centroCrop and fitXY, but always deform the images. The first type I know cuts the image, but the second one fits a size, but it does deform the image high or wide.



Is there any way, to insert it with Glide and see it as it is?
What properties have I to touch on ImageView and which of Glide?



 <ImageView
android:id="@+id/img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false"
app:layout_collapseMode="parallax"
android:scaleType="fitXY"
app:layout_scrollFlags="scroll|enterAlways" />


Thanks in advance.










share|improve this question













I have a lot of doubts about the treatment of the images in android, and I was hoping to see if you could solve them.



At this point I have an image that occupies 320 dp high, and match_parent width, which is around 60% of the screen.
This image of the load with Glide, of some images in 1080 that I have personally.



I tried to make centroCrop and fitXY, but always deform the images. The first type I know cuts the image, but the second one fits a size, but it does deform the image high or wide.



Is there any way, to insert it with Glide and see it as it is?
What properties have I to touch on ImageView and which of Glide?



 <ImageView
android:id="@+id/img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false"
app:layout_collapseMode="parallax"
android:scaleType="fitXY"
app:layout_scrollFlags="scroll|enterAlways" />


Thanks in advance.







android imageview resize glide






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 8 '17 at 10:40









Traif

54119




54119











  • Use .override(w,h) for it.
    – Piyush
    Sep 8 '17 at 10:41










  • And I have a image with no 1080? For example with an user. They have images with diferents sizes.
    – Traif
    Sep 8 '17 at 10:51










  • @Traif check custom transformation with Glide.
    – Raghunandan
    Sep 8 '17 at 10:56










  • Not understand.. what is your problem if you override(w,h)??
    – Ranjith Kumar
    Sep 8 '17 at 11:03
















  • Use .override(w,h) for it.
    – Piyush
    Sep 8 '17 at 10:41










  • And I have a image with no 1080? For example with an user. They have images with diferents sizes.
    – Traif
    Sep 8 '17 at 10:51










  • @Traif check custom transformation with Glide.
    – Raghunandan
    Sep 8 '17 at 10:56










  • Not understand.. what is your problem if you override(w,h)??
    – Ranjith Kumar
    Sep 8 '17 at 11:03















Use .override(w,h) for it.
– Piyush
Sep 8 '17 at 10:41




Use .override(w,h) for it.
– Piyush
Sep 8 '17 at 10:41












And I have a image with no 1080? For example with an user. They have images with diferents sizes.
– Traif
Sep 8 '17 at 10:51




And I have a image with no 1080? For example with an user. They have images with diferents sizes.
– Traif
Sep 8 '17 at 10:51












@Traif check custom transformation with Glide.
– Raghunandan
Sep 8 '17 at 10:56




@Traif check custom transformation with Glide.
– Raghunandan
Sep 8 '17 at 10:56












Not understand.. what is your problem if you override(w,h)??
– Ranjith Kumar
Sep 8 '17 at 11:03




Not understand.. what is your problem if you override(w,h)??
– Ranjith Kumar
Sep 8 '17 at 11:03












6 Answers
6






active

oldest

votes

















up vote
11
down vote



accepted










Override must be accessed via RequestOptions in the most recent version of Glide.



Glide
.with(context)
.load(path)
.apply(new RequestOptions().override(600, 200))
.into(imageViewResizeCenterCrop);





share|improve this answer





























    up vote
    3
    down vote













    in glide 4.x 'override' is in 'apply' :



    Glide.with(getBaseContext())
    .load(path)
    .apply(RequestOptions.placeholderOf(R.mipmap.no_wifi)
    .error(R.mipmap.no_wifi)
    .override(500,500))
    .into(mImageView);





    share|improve this answer



























      up vote
      2
      down vote













      Glide
      .with(context)
      .load(path)
      .override(600, 200)
      .centerCrop()
      .into(imageViewResizeCenterCrop);


      @Raghunandan is right.you should try transformation your own way.






      share|improve this answer
















      • 3




        Note: Override must be accessed via RequestOptions in the most recent version of glide: "apply(new RequestOptions().override(600, 200))"
        – Elletlar
        Apr 24 at 16:19

















      up vote
      0
      down vote













      If you want to load image without using glide then you can use scaleType "fitCenter" or "centerInside" as follows -



      <ImageView
      android:id="@+id/img"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:nestedScrollingEnabled="false"
      app:layout_collapseMode="parallax"
      android:scaleType="centerInside"
      app:layout_scrollFlags="scroll|enterAlways" />


      With Glide you can use override(w,h). When you use override(w,h), glide generates a new bitmap with width and height mentioned in override(w,h) and then load the image into ImageView. You can use fitCenter() to align the image. You can also use diskCacheStrategy(). If you don't use it, Glide will catch only newly generated bitmap. If you want to catch original image also then use diskCacheStrategy(DiskCacheStrategy.ALL).



      Glide.with(context)
      .load(image_path)
      .override(800, 400)
      .fitCenter()
      .diskCacheStrategy(DiskCacheStrategy.ALL)
      .into(imageView)


      I hope this helps.






      share|improve this answer
















      • 3




        Note: Override must be accessed via RequestOptions in the most recent version of Glide: "apply(new RequestOptions().override(800, 400))"
        – Elletlar
        Apr 24 at 16:18

















      up vote
      0
      down vote













      you have to do the following with your imageview :



       <ImageView
      android:id="@+id/img"
      android:layout_width="match_parent"
      android:layout_height="200dp"
      android:scaleType="fitCenter" />


      and this with your glide :



       Glide.with(getBaseContext())
      .load(path)
      //.placeholder(R.drawable.drawable)
      .error(R.drawable.noimg)
      .animate(R.anim.animation_fade_in)
      .into(mImageView);


      This works perfectly with me .






      share|improve this answer



























        up vote
        0
        down vote













        Glide 4.x - If you want get bitmap, try:



        Glide.with(mContext).asBitmap().
        load(pictureUri)
        .apply(new RequestOptions().override(50, 50))
        .listener(new RequestListener<Bitmap>()
        @Override
        public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource)
        return false;

        @Override
        public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource)
        // resource is your loaded Bitmap
        imgView.setImageBitmap(resource);
        return true;

        ).submit();





        share|improve this answer




















          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46114603%2fresize-images-with-glide-in-a-imageview-android%23new-answer', 'question_page');

          );

          Post as a guest






























          6 Answers
          6






          active

          oldest

          votes








          6 Answers
          6






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          11
          down vote



          accepted










          Override must be accessed via RequestOptions in the most recent version of Glide.



          Glide
          .with(context)
          .load(path)
          .apply(new RequestOptions().override(600, 200))
          .into(imageViewResizeCenterCrop);





          share|improve this answer


























            up vote
            11
            down vote



            accepted










            Override must be accessed via RequestOptions in the most recent version of Glide.



            Glide
            .with(context)
            .load(path)
            .apply(new RequestOptions().override(600, 200))
            .into(imageViewResizeCenterCrop);





            share|improve this answer
























              up vote
              11
              down vote



              accepted







              up vote
              11
              down vote



              accepted






              Override must be accessed via RequestOptions in the most recent version of Glide.



              Glide
              .with(context)
              .load(path)
              .apply(new RequestOptions().override(600, 200))
              .into(imageViewResizeCenterCrop);





              share|improve this answer














              Override must be accessed via RequestOptions in the most recent version of Glide.



              Glide
              .with(context)
              .load(path)
              .apply(new RequestOptions().override(600, 200))
              .into(imageViewResizeCenterCrop);






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Sep 9 at 9:25

























              answered Jun 10 at 10:36









              Bhuvanesh BS

              3,71621646




              3,71621646






















                  up vote
                  3
                  down vote













                  in glide 4.x 'override' is in 'apply' :



                  Glide.with(getBaseContext())
                  .load(path)
                  .apply(RequestOptions.placeholderOf(R.mipmap.no_wifi)
                  .error(R.mipmap.no_wifi)
                  .override(500,500))
                  .into(mImageView);





                  share|improve this answer
























                    up vote
                    3
                    down vote













                    in glide 4.x 'override' is in 'apply' :



                    Glide.with(getBaseContext())
                    .load(path)
                    .apply(RequestOptions.placeholderOf(R.mipmap.no_wifi)
                    .error(R.mipmap.no_wifi)
                    .override(500,500))
                    .into(mImageView);





                    share|improve this answer






















                      up vote
                      3
                      down vote










                      up vote
                      3
                      down vote









                      in glide 4.x 'override' is in 'apply' :



                      Glide.with(getBaseContext())
                      .load(path)
                      .apply(RequestOptions.placeholderOf(R.mipmap.no_wifi)
                      .error(R.mipmap.no_wifi)
                      .override(500,500))
                      .into(mImageView);





                      share|improve this answer












                      in glide 4.x 'override' is in 'apply' :



                      Glide.with(getBaseContext())
                      .load(path)
                      .apply(RequestOptions.placeholderOf(R.mipmap.no_wifi)
                      .error(R.mipmap.no_wifi)
                      .override(500,500))
                      .into(mImageView);






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Aug 12 at 4:41









                      ArMo 372

                      80211228




                      80211228




















                          up vote
                          2
                          down vote













                          Glide
                          .with(context)
                          .load(path)
                          .override(600, 200)
                          .centerCrop()
                          .into(imageViewResizeCenterCrop);


                          @Raghunandan is right.you should try transformation your own way.






                          share|improve this answer
















                          • 3




                            Note: Override must be accessed via RequestOptions in the most recent version of glide: "apply(new RequestOptions().override(600, 200))"
                            – Elletlar
                            Apr 24 at 16:19














                          up vote
                          2
                          down vote













                          Glide
                          .with(context)
                          .load(path)
                          .override(600, 200)
                          .centerCrop()
                          .into(imageViewResizeCenterCrop);


                          @Raghunandan is right.you should try transformation your own way.






                          share|improve this answer
















                          • 3




                            Note: Override must be accessed via RequestOptions in the most recent version of glide: "apply(new RequestOptions().override(600, 200))"
                            – Elletlar
                            Apr 24 at 16:19












                          up vote
                          2
                          down vote










                          up vote
                          2
                          down vote









                          Glide
                          .with(context)
                          .load(path)
                          .override(600, 200)
                          .centerCrop()
                          .into(imageViewResizeCenterCrop);


                          @Raghunandan is right.you should try transformation your own way.






                          share|improve this answer












                          Glide
                          .with(context)
                          .load(path)
                          .override(600, 200)
                          .centerCrop()
                          .into(imageViewResizeCenterCrop);


                          @Raghunandan is right.you should try transformation your own way.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Sep 8 '17 at 11:01









                          Radhey

                          1,35011333




                          1,35011333







                          • 3




                            Note: Override must be accessed via RequestOptions in the most recent version of glide: "apply(new RequestOptions().override(600, 200))"
                            – Elletlar
                            Apr 24 at 16:19












                          • 3




                            Note: Override must be accessed via RequestOptions in the most recent version of glide: "apply(new RequestOptions().override(600, 200))"
                            – Elletlar
                            Apr 24 at 16:19







                          3




                          3




                          Note: Override must be accessed via RequestOptions in the most recent version of glide: "apply(new RequestOptions().override(600, 200))"
                          – Elletlar
                          Apr 24 at 16:19




                          Note: Override must be accessed via RequestOptions in the most recent version of glide: "apply(new RequestOptions().override(600, 200))"
                          – Elletlar
                          Apr 24 at 16:19










                          up vote
                          0
                          down vote













                          If you want to load image without using glide then you can use scaleType "fitCenter" or "centerInside" as follows -



                          <ImageView
                          android:id="@+id/img"
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:nestedScrollingEnabled="false"
                          app:layout_collapseMode="parallax"
                          android:scaleType="centerInside"
                          app:layout_scrollFlags="scroll|enterAlways" />


                          With Glide you can use override(w,h). When you use override(w,h), glide generates a new bitmap with width and height mentioned in override(w,h) and then load the image into ImageView. You can use fitCenter() to align the image. You can also use diskCacheStrategy(). If you don't use it, Glide will catch only newly generated bitmap. If you want to catch original image also then use diskCacheStrategy(DiskCacheStrategy.ALL).



                          Glide.with(context)
                          .load(image_path)
                          .override(800, 400)
                          .fitCenter()
                          .diskCacheStrategy(DiskCacheStrategy.ALL)
                          .into(imageView)


                          I hope this helps.






                          share|improve this answer
















                          • 3




                            Note: Override must be accessed via RequestOptions in the most recent version of Glide: "apply(new RequestOptions().override(800, 400))"
                            – Elletlar
                            Apr 24 at 16:18














                          up vote
                          0
                          down vote













                          If you want to load image without using glide then you can use scaleType "fitCenter" or "centerInside" as follows -



                          <ImageView
                          android:id="@+id/img"
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:nestedScrollingEnabled="false"
                          app:layout_collapseMode="parallax"
                          android:scaleType="centerInside"
                          app:layout_scrollFlags="scroll|enterAlways" />


                          With Glide you can use override(w,h). When you use override(w,h), glide generates a new bitmap with width and height mentioned in override(w,h) and then load the image into ImageView. You can use fitCenter() to align the image. You can also use diskCacheStrategy(). If you don't use it, Glide will catch only newly generated bitmap. If you want to catch original image also then use diskCacheStrategy(DiskCacheStrategy.ALL).



                          Glide.with(context)
                          .load(image_path)
                          .override(800, 400)
                          .fitCenter()
                          .diskCacheStrategy(DiskCacheStrategy.ALL)
                          .into(imageView)


                          I hope this helps.






                          share|improve this answer
















                          • 3




                            Note: Override must be accessed via RequestOptions in the most recent version of Glide: "apply(new RequestOptions().override(800, 400))"
                            – Elletlar
                            Apr 24 at 16:18












                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          If you want to load image without using glide then you can use scaleType "fitCenter" or "centerInside" as follows -



                          <ImageView
                          android:id="@+id/img"
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:nestedScrollingEnabled="false"
                          app:layout_collapseMode="parallax"
                          android:scaleType="centerInside"
                          app:layout_scrollFlags="scroll|enterAlways" />


                          With Glide you can use override(w,h). When you use override(w,h), glide generates a new bitmap with width and height mentioned in override(w,h) and then load the image into ImageView. You can use fitCenter() to align the image. You can also use diskCacheStrategy(). If you don't use it, Glide will catch only newly generated bitmap. If you want to catch original image also then use diskCacheStrategy(DiskCacheStrategy.ALL).



                          Glide.with(context)
                          .load(image_path)
                          .override(800, 400)
                          .fitCenter()
                          .diskCacheStrategy(DiskCacheStrategy.ALL)
                          .into(imageView)


                          I hope this helps.






                          share|improve this answer












                          If you want to load image without using glide then you can use scaleType "fitCenter" or "centerInside" as follows -



                          <ImageView
                          android:id="@+id/img"
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:nestedScrollingEnabled="false"
                          app:layout_collapseMode="parallax"
                          android:scaleType="centerInside"
                          app:layout_scrollFlags="scroll|enterAlways" />


                          With Glide you can use override(w,h). When you use override(w,h), glide generates a new bitmap with width and height mentioned in override(w,h) and then load the image into ImageView. You can use fitCenter() to align the image. You can also use diskCacheStrategy(). If you don't use it, Glide will catch only newly generated bitmap. If you want to catch original image also then use diskCacheStrategy(DiskCacheStrategy.ALL).



                          Glide.with(context)
                          .load(image_path)
                          .override(800, 400)
                          .fitCenter()
                          .diskCacheStrategy(DiskCacheStrategy.ALL)
                          .into(imageView)


                          I hope this helps.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Sep 8 '17 at 11:46









                          Anand Soni

                          212




                          212







                          • 3




                            Note: Override must be accessed via RequestOptions in the most recent version of Glide: "apply(new RequestOptions().override(800, 400))"
                            – Elletlar
                            Apr 24 at 16:18












                          • 3




                            Note: Override must be accessed via RequestOptions in the most recent version of Glide: "apply(new RequestOptions().override(800, 400))"
                            – Elletlar
                            Apr 24 at 16:18







                          3




                          3




                          Note: Override must be accessed via RequestOptions in the most recent version of Glide: "apply(new RequestOptions().override(800, 400))"
                          – Elletlar
                          Apr 24 at 16:18




                          Note: Override must be accessed via RequestOptions in the most recent version of Glide: "apply(new RequestOptions().override(800, 400))"
                          – Elletlar
                          Apr 24 at 16:18










                          up vote
                          0
                          down vote













                          you have to do the following with your imageview :



                           <ImageView
                          android:id="@+id/img"
                          android:layout_width="match_parent"
                          android:layout_height="200dp"
                          android:scaleType="fitCenter" />


                          and this with your glide :



                           Glide.with(getBaseContext())
                          .load(path)
                          //.placeholder(R.drawable.drawable)
                          .error(R.drawable.noimg)
                          .animate(R.anim.animation_fade_in)
                          .into(mImageView);


                          This works perfectly with me .






                          share|improve this answer
























                            up vote
                            0
                            down vote













                            you have to do the following with your imageview :



                             <ImageView
                            android:id="@+id/img"
                            android:layout_width="match_parent"
                            android:layout_height="200dp"
                            android:scaleType="fitCenter" />


                            and this with your glide :



                             Glide.with(getBaseContext())
                            .load(path)
                            //.placeholder(R.drawable.drawable)
                            .error(R.drawable.noimg)
                            .animate(R.anim.animation_fade_in)
                            .into(mImageView);


                            This works perfectly with me .






                            share|improve this answer






















                              up vote
                              0
                              down vote










                              up vote
                              0
                              down vote









                              you have to do the following with your imageview :



                               <ImageView
                              android:id="@+id/img"
                              android:layout_width="match_parent"
                              android:layout_height="200dp"
                              android:scaleType="fitCenter" />


                              and this with your glide :



                               Glide.with(getBaseContext())
                              .load(path)
                              //.placeholder(R.drawable.drawable)
                              .error(R.drawable.noimg)
                              .animate(R.anim.animation_fade_in)
                              .into(mImageView);


                              This works perfectly with me .






                              share|improve this answer












                              you have to do the following with your imageview :



                               <ImageView
                              android:id="@+id/img"
                              android:layout_width="match_parent"
                              android:layout_height="200dp"
                              android:scaleType="fitCenter" />


                              and this with your glide :



                               Glide.with(getBaseContext())
                              .load(path)
                              //.placeholder(R.drawable.drawable)
                              .error(R.drawable.noimg)
                              .animate(R.anim.animation_fade_in)
                              .into(mImageView);


                              This works perfectly with me .







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Aug 6 at 2:17









                              Mu'ayyad Ayesh

                              11




                              11




















                                  up vote
                                  0
                                  down vote













                                  Glide 4.x - If you want get bitmap, try:



                                  Glide.with(mContext).asBitmap().
                                  load(pictureUri)
                                  .apply(new RequestOptions().override(50, 50))
                                  .listener(new RequestListener<Bitmap>()
                                  @Override
                                  public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource)
                                  return false;

                                  @Override
                                  public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource)
                                  // resource is your loaded Bitmap
                                  imgView.setImageBitmap(resource);
                                  return true;

                                  ).submit();





                                  share|improve this answer
























                                    up vote
                                    0
                                    down vote













                                    Glide 4.x - If you want get bitmap, try:



                                    Glide.with(mContext).asBitmap().
                                    load(pictureUri)
                                    .apply(new RequestOptions().override(50, 50))
                                    .listener(new RequestListener<Bitmap>()
                                    @Override
                                    public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource)
                                    return false;

                                    @Override
                                    public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource)
                                    // resource is your loaded Bitmap
                                    imgView.setImageBitmap(resource);
                                    return true;

                                    ).submit();





                                    share|improve this answer






















                                      up vote
                                      0
                                      down vote










                                      up vote
                                      0
                                      down vote









                                      Glide 4.x - If you want get bitmap, try:



                                      Glide.with(mContext).asBitmap().
                                      load(pictureUri)
                                      .apply(new RequestOptions().override(50, 50))
                                      .listener(new RequestListener<Bitmap>()
                                      @Override
                                      public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource)
                                      return false;

                                      @Override
                                      public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource)
                                      // resource is your loaded Bitmap
                                      imgView.setImageBitmap(resource);
                                      return true;

                                      ).submit();





                                      share|improve this answer












                                      Glide 4.x - If you want get bitmap, try:



                                      Glide.with(mContext).asBitmap().
                                      load(pictureUri)
                                      .apply(new RequestOptions().override(50, 50))
                                      .listener(new RequestListener<Bitmap>()
                                      @Override
                                      public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource)
                                      return false;

                                      @Override
                                      public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource)
                                      // resource is your loaded Bitmap
                                      imgView.setImageBitmap(resource);
                                      return true;

                                      ).submit();






                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Nov 9 at 15:11









                                      Lam Nguyen

                                      6122




                                      6122



























                                           

                                          draft saved


                                          draft discarded















































                                           


                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function ()
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46114603%2fresize-images-with-glide-in-a-imageview-android%23new-answer', 'question_page');

                                          );

                                          Post as a guest














































































                                          Popular posts from this blog

                                          Darth Vader #20

                                          How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

                                          Ondo