Git Product home page Git Product logo

Comments (8)

Lymphatus avatar Lymphatus commented on September 2, 2024

Definitely a), b) would be very confusing. Can you provide one or more of the images that actually have a size increase after compression? I'd like to have a look at them for testing purposes.

from caesiumph.

Voodoopupp avatar Voodoopupp commented on September 2, 2024

Can i just drop them here? Or will they get compressed or something by github? Or should I e-mail them?

from caesiumph.

Lymphatus avatar Lymphatus commented on September 2, 2024

I think they won't be compressed by GitHub, but, just to be sure: caesiumph {at} saerasoft [dot] com

from caesiumph.

Voodoopupp avatar Voodoopupp commented on September 2, 2024

okay, email has been sent :)

from caesiumph.

Lymphatus avatar Lymphatus commented on September 2, 2024

While I investigate on the compression results to completely avoid increasing the size - although it's impossible to be 100% sure it won't happen sometimes - there's the fix. Since we can't exactly predict the output filesize due to EXIF, the file is actually compressed and then the software will check whether the output is bigger or not. If this happens, the output file is removed and is replaced by a copy of it. More precisely, if we wanted to overwrite the originals, the output files are actually compressed in a temporary directory and eventually moved over the originals. The temporary folder is destroyed when CaesiumPH is closed.

from caesiumph.

Voodoopupp avatar Voodoopupp commented on September 2, 2024

Sounds great, so if we won´t overwrite the originals, let's say we sent the compressed images to a custom folder or subfolder it will

  1. compress images and send to the selected folder
  2. will now compare this folder with the temporary files?

Or will it be just on the fly image after image?

from caesiumph.

Lymphatus avatar Lymphatus commented on September 2, 2024

On the fly. For each compressed file, it performs the check and copy the original file into the subfolder/custom folder.

This is the flow if we don't want to overwrite the originals:

  1. Compress the file into the new folder (or with a suffix)
  2. Compare sizes
  3. If the compressed is bigger, remove it and replace it with a copy of the original

Instead, if we want to overwrite them:

  1. Compress the file in a temporary folder (which is different everytime CaesiumPH is started)
  2. Compare sizes
  3. If the output is smaller, move the file from the temporary folder into the original one, overwriting the file (the original is actually being removed before moving the new one). If it's bigger, do nothing as the original is already in the right place
  4. Destroy the temporary folder on CaesiumPH exit

This way is a bit slower than the previous process because we need to remove/move some files in a few cases, especially when overwriting them.
Also, doing this on the fly for each file ensures the right behaviour upon cancelling the process or if an unexpected error kicks in.

from caesiumph.

Voodoopupp avatar Voodoopupp commented on September 2, 2024

Okay, sounds exaclty the right way. Sure, speed is a bit slower, but I think in the end the result is the more important thing ;)

from caesiumph.

Related Issues (18)

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.