maforget / ComicRackCE

A Community Edition for the legendary Comic Book Manager ComicRack. ComicRack is back from the dead.
GNU General Public License v2.0
295 stars 32 forks source link

FIX for issue #74 - Re-export a comic with WEBP images, changes the images to JPEG #91

Closed BrokenRSA closed 2 months ago

BrokenRSA commented 2 months ago

Fix for WEBP files being converted back to JPEGs when re-exporting to WEBP format. This fix should also apply to DJVU formats as well.

close #74

github-actions[bot] commented 2 months ago

Build Successful! You can find a link to the downloadable artifact below.

Name Link
Commit 04cae61c6b2d5651ec900a8fff990c7ecb43156d
Logs https://github.com/maforget/ComicRackCE/actions/runs/10102468551
Download https://github.com/maforget/ComicRackCE/suites/26443099330/artifacts/1741723080
maforget commented 2 months ago

I've modified your code because it broke my Merge Pages features, that used the PagePool for storing the temp image. On Export it would take the merged image from the pool.

Since all PagePool are also JPEG's you had to also take the source image instead of the page pool image, thus breaking my feature. Your GetByteImageForExport function will instead return a class that contains the image and a flag to either convert or not. So when merging pages, even with preserve original format, it will convert the merged image to the desired format.

This whole part was unnecessary, since you just called the same function either way. But it was useful for me fixing it for the merge feature. https://github.com/BrokenRSA/ComicRackCE/blob/80d09ecfb28f61061300e28e2b9ae068b9849538/ComicRack.Engine/IO/Provider/Readers/CombinedComics.cs#L91-L100

I've also removed the RetrieveSourceByteImageKeepSource and just added an optional parameter instead, to reduce duplicated code.

Fixed a bug with my merge feature, while I was there.

I'll wait for your feedback before merging.

BrokenRSA commented 2 months ago

I'm happy with your changes, it's way more elegant than my hacks. I tested on my test files, and everything works as expected.