-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving remote jpg without the need to go from jpg->bitmap->jpg #1025
Comments
I would suggest you download the image first using okhttp and then load it from disk using Picasso. This type of feature doesn't really make sense to duplicate in Picasso. |
Custom You cannot attach a custom downloader per request at the moment, if that is what you are trying to achieve, you are better off with a different implementation to achieve this. |
@jacobtabak: Just to clarify, I am downloading images on demand when the user swipes through a fullscreen view. What you are suggesting is that in the PagerAdapter's instantiateItem() method, I set a placeholder image and then trigger an AsyncTask that will take the ImageView object, and download the image using okhttp and use Picasso to then set the downloaded image to the ImageView. Is there any pitfalls in this approach related to lifecycle of ImageView? |
Dupe #506 |
@lokewate I'd probably do it like this until official support is added:
Here's some code to download a file with okhttp/okio -
|
should be
and those |
Thanks all for the interim solution. Just to clarify, this is how I created the Picasso object.
|
When a jpg is downloaded from a server using load(url).into(target),
target
only allows for accessing the image using a Bitmap through onBitmapLoaded(). However, if we want to save this image locally, then the bitmap needs to be converted to a jpg, which would cause quality loss. There should be a way to save the downloaded data directly.The text was updated successfully, but these errors were encountered: