Giter Club home page Giter Club logo

Comments (5)

LGatodu47 avatar LGatodu47 commented on July 4, 2024 1

Hi,

Did some benchmarking and some more research about what you were speaking about with image compression and it can indeed speed up loading times by a significant amount (in fact during my tests I noticed the loading time is exponentially faster the lower the resolution is). So I'll probably fork the main branch in order to work on this feature for the next version of the mod. I think I would leave it optional, because it implies creating "temporary" thumbnail files, which might take space on the user's computer without him knowing about it.

Oh and I figured out why there was a little lag for loading images, it's because you're sorting your screenshots by descending order, and the bug is that it's loading the screenshots in ascending order. I'm pretty sure this will be fixed in the next version (if I don't forget about it).

from screenshotviewer.

BakinDP avatar BakinDP commented on July 4, 2024

For a little more context, I have an OC Ryzen 9 5950X, 24Gb RAM dedicated and PCIe 3.0 NVME TLC SSD. The game runs Fabric 1.20.1 with all most popular optimization mods. Actual for the latest release of Screenshot Viewer.

from screenshotviewer.

LGatodu47 avatar LGatodu47 commented on July 4, 2024

Hello,
Thank you for your feedback. When you say "It takes a lot of time to load existing screenshots" ; are you saying that there's a lag when opening the screen? Or that the images take a long time to load? Or maybe just the fact that loading all screenshots are inefficient?
If you experience any real issue, maybe you can send a quick video just so I have better insight into what's going on. I've tried replicating such issues with a high number of images, and it all seemed to load perfectly, maybe it's due to my graphics card, being a RTX 2060.

Regarding your suggestion for thumbnails, it might not be such a good idea. Minecraft uses the library STB_image in order to load images into the game, and Screenshot Viewer uses it too. And from what I know, there's no method to load any thumbnail/compressed subimage of an image in this library, meaning that an implementation of such a feature would require loading the full size image, compressing it, and caching the compressed version, which requires a lot of operations for a screen that must be reloaded every time it is opened. Screenshot images load asynchronously, and are cached for the whole duration the Manage Screenshots screen is open. That's why I'm pretty skeptical about adding this feature. I'm not convinced it would really perform better.

I'd like to hear your thoughts about this. Have a nice day!

from screenshotviewer.

BakinDP avatar BakinDP commented on July 4, 2024

Thanks for the reply!

There is a lag (stutter), not a huge problem, and a delay on loading and therefore accessing images, which is actually important.
https://github.com/LGatodu47/ScreenshotViewer/assets/74774853/f09b3d13-9606-458e-8b3d-9ef211cca102

My idea is to implement scanning through screenshots folder in minecraft (I'll call it 'source') and comparing existing images with contents of folder with thumbnails ('preview'), which is initially created and empty on first boot with mod.
If the image from source is not detected in preview (by name, for example), then the mod will process one-time compression and saving of this image to preview, then load the image to widget directly from compression buffer. Later, the general reading function (could't find it) will detect existing thumbnails and call general loading function (this too) with thumbnail's path instead of full-size image, so the getImage(screenshotFile) gets a thumbnail's contents.

Once thumbnails are loaded, the other part of mod will begin loading full-size images and open them on user click, just as it does now.

As the situation of thumbnail not representing the original image is rare due to how minecraft saves them, it still would be nice to have a button to repeat the process of compression for each image individually or the entire folder.

I understand that this method may not help with the initial delay (when screenshots are completely empty) or even worsen it by a bit with extra computations, but it definitely should help with faster finishing of IO work and closing threads especially with highres images.

from screenshotviewer.

BakinDP avatar BakinDP commented on July 4, 2024

So glad to hear that! Thank you for your work!

from screenshotviewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.