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
HQ version isn't downloaded for some images #2207
Comments
That is not actually how it works, it downloads the content url when you're in data saving mode and downloads the currently displayed image if you are not in data saving mode, and never the low quality version. I don't really know why it appears to be doing that behavior, but I don't really think it's possible for Slide to be doing that. I have personally never seen this happen |
That seems to be what's happening pretty much all the time, but it seems like occasionally a lower quality version is saved. Not the LQ version that gets displayed in the app, but something in-between. Just in case you haven't, could you try opening the links I posted above and saving them? If what gets saved is similar to what I got, then it's reproducible, and if it's a bug, it can be fixed. If, however, the correct HQ version is saved on your end, perhaps it depends on specific settings, in which case I'll try more testing. |
It is loading correctly for me on and off wifi. I think the issue might actually lie with your gallery app, Google Photos shows a pixelated version of the image regardless of where it's downloaded from (Slide or Chrome), and the image you linked to actually doesn't obey the data saving settings for Imgur (it's not on Imgur), so the issue cannot lie with data saving settings and is most likely not Slide related |
Just to check, you mean downloading or loading in-app? Because in-app the app loads the highest quality available just fine. It's the downloading that I'm experiencing issues with.
I'm using QuickPic and checking the detail for each image to check the size. If there's any other app that you consider more reliable, please tell me and I will check with those.
This is probably true, since it happens to me regardless of what data saving settings I have.
I genuinely dislike saying this because I find constantly comparing with rival apps disrespectful, but this is for the purpose of testing, so I tried opening the first link in Sync, and then downloading it, and the correct gigantic version (roughly 16 MB) was saved. I didn't try other apps cause it takes too long to load that image, and I'm about to leave for class. I can try it later if you want. As for the second link, Boost, Sync, Relay, and Opengur all download a 4608 x 3233 image. I can look for more links that have this behavior, if you think that helps with debugging. |
Yes, I'm referring to downloading. Downloading the images both on and off data saving mode are identical to the ones downloaded in chrome by opening the image externally for the links you provided in the OP (the 16mb one). I'm really not able to reproduce that behavior, and the code also makes it impossible to be downloading the lq image (the link displayed is not the same as the one downloaded, if the image is lq then it will display a reduced size image but keeps the original link in tact), as it creates a new activity with the link provided in the submission, and downloads that file separately from the media view. The fact that it can't be reproduced on my devices under the same circumstances leads me to believe it is not something relating to Slide (also, I've never had another report of this). Is there anything that would be interfering with this on your device? |
I see. That's certainly strange. I'm assuming the saved file for the second link is also the 4608 x 3233 one on your end, right? I can't think of anything that could be interfering with this, but I'll try and test different settings, and on different devices. Thanks for the help. EDIT1: just tried downloading that image again. 16 MB of data was used, the amount of time it took to download matches the images size, but what's saved is 337 KB. Checked with QuickPic and Solid Explorer. That's really weird. EDIT2: BTW, while that image isn't hosted on Imgur, I get an HQ button when I open that image with either data saving mode (Reddit or Imgur). And the one displayed by default is definitely not the HQ version (I can tell because the top and bottom are cropped). Is that a bug? EDIT3: changed data saving mode to Imgur, cleared Slide's cache, closed Slide from recents, opened that thread, and tapped download. Once again roughly 16 MB of data was used, the time it took matches the 16 MB size and my connection speed, but the saved file is 337 KB with a resolution of 240 x 1345. EDIT4: based on what I described above, it seems like the issue isn't happening when downloading, but when actually saving what's downloaded. What do you think? EDIT6: Tried on my Xperia Z1. It's less modified than my daily, with the only changes being a lowered DPI and KCAL. Same result as above. I updated Slide to 5.5-alpha2-dirty, cleared its data, and went straight to that post without logging in or changing any settings. It seems to download roughly 16 MB, but what's saved is the 337 KB one. I'll try to test it on a completely stock device later. |
Are you 100% sure your gallery app is displaying the image correctly? It saves the bytes downloaded directly and doesn't compress or mess with it at all (straight to file). Also it will show the HQ button if there is a displayed lq Reddit hosted image, and it will load the actual content URL when you click it. It could also just be the file has the incorrect size stated in the metadata, but the actual file itself is 16 mb (an issue with the image uploaded, not with how Slide downloaded it). |
I highly doubt it's incorrect, but it's certainly a possibility, which is why I checked in Solid Explorer, which also said it's a 337 KB file. I understand that you wouldn't want to waste time trying to debug something only to find out that it was caused by a different app showing the file size incorrectly, so if there's any other app you want me to check with, please tell me. I can even upload the downloaded file somewhere if that helps.
Oops, I'd forgotten how data saving functioned. My bad.
That would probably cause the image downloaded from other apps to have the same issue, but they don't seem to. EDIT: as promised, I tested on a stock Z5 (6.0.1). I installed Slide, found the post, and downloaded the image. I didn't change any settings. Same result. |
So I tried something different. I cleared Slide's cache, swiped it away from recents, opened the second link and downloaded it. Then I went to /sdcard/emulated/0/Android/data/me.ccrama.redditslide/cache, and since I'd only opened a single post after clearing Slide's cache, there were only 3 files, one of which was just called "journal". Of the other two, one was the LQ version that got displayed when I opened the post, but the other one was the correct file: 2.1 MB (2.06 on my phone, but it's just different counting methods), with a resolution of 4608 x 3233. Still, what actually gets saved in my chosen directory is 1152 x 809 and 1.34 MB. So whatever's happening, it's definitely after it finishes downloading. |
It turns out it was scaling based on your device density, and yours was probably low and scaling it proportionally. Should be fixed now |
Sweet. Thanks. |
Got the update. The app now behaves differently, but there are still some issues.
Density being the cause makes sense to an extent, since my Z2 and Z1 are running on 400 instead of the stock 480, but the Note and the Z5 were running stock DPI. The Z5 was completely stock in every way. |
It could very well be the conversion from a jpg to a png that is giving you these results. Nothing in the code is scaling the images at all |
I'm not sure I follow. What part of the software on my phone would be responsible for that if not Slide? |
JPG format is different than PNG, PNG is more compact than a JPG file, which is converted when saving through Slide (all images are saved as PNG regardless of what they began as). The file is not the same as the one on Imgur, it is a differently compressed one |
So Slide converts to PNG regardless of the original format? May I ask why? |
It is more compact and I have to choose either PNG or JPG. JPG is better for flat gradients like images, while PNG is better for text which I assumed to be the majority of Reddit images to be saved. Slide downloads the image into memory into a bitmap, and I then convert that bitmap into a PNG file. Other major apps (and Imgur apps) do this as well. Definitely explains the difference in file size, though! |
So there's no way to make the app save whatever the original file is? Assuming what you're saying is true, that would mean all images saved by a single app will either be .jpg or .PNG right? |
The code was based off of Opengur, so yes that is what it does. And no, sorry. There is really no downside to it though, photos are usually saved in PNG format anyway which has more efficient compression |
Without naming anything, I see some other apps which save both pngs and jpegs, so I find it hard to believe that it's completely impossible.
Compared to an implementation where everything is saved as-is, I'd say saving a 2 MB image as a 16 MB file is a downside. Especially for people with limited internal storage. |
I didn't say it is impossible, but I personally don't think it's worth rewriting the system to support both file types. JPG images are lossier than PNG, and you are getting a better/original quality image with PNG (recompressing JPG images is not good, that's how you get JPG artifacts) |
I wouldn't really disagree with you if it was just file size, but for me it's currently affecting image quality as well on some links. It's just not as pleasant when I have to use other apps to download images when I want to be sure I get what I wanted.
PNG seems to be smaller only when an image is mostly the exact same color (like a non-compressed screenshot from an app), so if the original is .jpeg and therefore already compressed, I doubt converting to PNG would lead to much other than a larger file. And as I said, for me the file downloaded from the second link is lower quality than the original while being a lot larger in size. I can upload what Slide downloaded on my device if you want to check. I also checked Opengur's files, and while you're right in that it saves everything as a .jpeg, it doesn't seem to actually be converting anything. I downloaded a png from Opengur and while the filename does indeed say .jpeg, according to QuickPic the MIMEtype is still PNG. And on desktop Photoshop refuses to open the file saying:
It works fine after renaming to .PNG. On the other hand, it looks like Slide doesn't just change the extension in the name, but also converts the file. QuickPic shows MIMEtype for all Slide downloads as PNG, even for ones that I'm certain are from .jpeg links. Also, my first example link was already a PNG, so considering the difference in file size between Slide and desktop, that means Slide converts both PNGs and jpegs to PNG. Anyway, thanks for taking the time to respond. I really appreciate it :) |
It was actually pretty easy to tell it to copy the cached file from UIL, so it should be the original file from the server instead of a recompressed image. This should fix any discrepancy between file type and size, and the final release will name the file the same as it was on the Imgur server. Thank you for the in-depth analysis! And that is interesting that Opengur names it but does not recompress it, they should probably do what I'm doing as well :) |
Sweet! Looking forward to the next update. Thanks again. |
Got the alpha-4 update. I tried a few links (including my second example link) after updating and clearing cache, and they're all getting saved as PNGs, and the sizes don't match either. Or did I misunderstand your previous comment? |
That isn't really possible, are you sure you updated? |
App info (from the Settings app) says 5.5-alpha4. Same in Slide's about section. Maybe I need to do a reinstall? |
Actually the file name may be incorrect but the contents are correct |
The second image was still 16.69 MB, and QuickPic shows MIMEtype as PNG. It might get fixed with a reinstall, so I'll try that later. |
Are you sure the image you were downloading is not a PNG? This is pulling the file directly from Imgur and copying it to your storage, there is really not much room to go wrong. A reinstall probably won't do anything (reinstalls only really could fix issues with cache or files in storage, not the code of the app) |
It's this link. |
If it pulled the image from Reddit, it's saving the Reddit PNG image instead of the Imgur one. Other than that, I really don't know man :/ |
Time for more testing :)
And it was 16.69 MB with the file extension and MIMEtype both being PNG. Next, I tried the following:
Same as above, 16.69 MB, with file extension and MIMEtype both showing PNG in QuickPic. Since you said it might be saving the Reddit PNG, I figured this test might be useful since a comment preview (that's not posted) is on the device, not on Reddit. Then to be sure I:
Same result. Take this more as an FYI. I don't want you to stress yourself over this. |
BTW, could we keep this open for now? It doesn't seem widespread so I know it doesn't deserve a high priority, but it'd be great if it could be fixed at some point. |
Is the file name a large random string? If so, it's the Reddit image and this is the intended behavior and the image from Imgur cannot be compared to the image from Reddit, because they are different |
I made a few more changes which will hopefully fix the issue you're seeing |
Looks like it, but is there any other case? All images saved by Slide seem to have random names.
Not sure what this means. Does this mean what gets downloaded isn't from Imgur? Wouldn't the test I did (loading it from a comment preview) circumvent Reddit entirely?
Thank you. Fingers crossed! |
Just installed 5.5 (from APKMirror, that is). Second example link is now working! Correct file size, resolution, file extension, and MIMEtype. Same for the first link. Sweet!
EDIT: This should probably be a separate issue. And thanks so much for all the work you did on this! |
Slide version: 5.5-alpha2-dirty
Android version: 6.0.1
I've experienced this issue where for some images, tapping HQ does indeed load the HQ version, but downloading it doesn't save the high res version. I am using "Low Quality through Reddit (lower resolution)" for image data saving.
Example 1
If you open this on desktop, you'll see that it's a gigantic 16.4 MB image with a resolution of 1920 x 10762. Slide does indeed load this version when HQ is tapped, but when I download the image, what's saved is 337 KB and has a resolution of 240x1345.
Example 2
Like the one above, what you get on desktop is a 4608 x 3233 image and a size of 2.1 MB, which is what Slide loads when HQ is tapped, but what gets downloaded is a 1152 x 809, 0.93 MB image.
I also tried both with data saving completely disabled. Both images showed the correct high res versions by default, but the smaller images were downloaded regardless.
I can look for more examples if that helps.
EDIT: I've played around with a few more images, and in some cases the opposite happens. What gets downloaded is larger in size and higher in resolution than what gets loaded when HQ is tapped. While I'm personally not bothered by that one, I think it'd be better if both tapping HQ and download the image consistently downloaded the highest resolution possible.
The text was updated successfully, but these errors were encountered: