Commit graph

10 commits

Author SHA1 Message Date
wisp3rwind
c45d2e28a6 artresizer: move resize functions to backend classes 2022-03-12 20:23:37 +01:00
wisp3rwind
8a969e3041 artresizer: backend classes part 1: stub classes, version checks 2022-03-12 19:48:45 +01:00
wisp3rwind
0125b1cd42 artresizer: in backends, always use the appropriate ArtResizer instance
This didn't cause any issues since we only use the shared instance
anyway, but logically it doesn't make a lot of sense for the backends
always using ArtResizer.shared (which they should be oblivious of).
2022-02-12 22:45:22 +01:00
Piotrek Kochański
1a130059e8 deinterlace option to affect when no other processing
remove interlacing by default when resizing/down-scaling, the
`deinterlace` option is to remove interlace when otherwise no processing
would have happened.
2021-11-01 13:51:57 +01:00
Piotrek Kochański
417ef0d453 Merge branch 'master' of github.com:beetbox/beets into deinterlace 2021-10-31 13:27:00 +01:00
Piotrek Kochański
54522e6908 Remove extraneous empty line that failed lint. 2021-08-26 13:18:15 +02:00
Andrew Rogl
ee4268dabb Remove unused imports
Fix imports
Fix formatting
2021-08-26 20:59:48 +10:00
Andrew Rogl
1ec87a3bdd pyupgrade beetsplug and tests
All tests working
More tidy up to be done
2021-08-26 19:12:51 +10:00
Piotrek Kochański
c6e05e8ab7 Add tests to check deinterlace functionality. 2021-08-25 22:55:54 +02:00
David Swarbrick
07b5e69f40 fetchart/artresizer: add max_filesize support (#3560)
Squashed from the PR, relevant commit messages follow below:

Added file size option to artresizer

 - In line with comments on PR, adjusted the ArtResizer API to add
   functionality to "resize to X bytes" through `max_filesize` arg

 - Adjustment to changelog.rst to include max_filesize change to ArtResizer
   and addition of new plugin.

Added explicit tests for PIL & Imagemagick Methods

 - Checks new resizing functions do reduce the filesize of images

Expose max_filesize logic to fetchart plugin

- Add syspath escaping for OS cross compatibility
- Return smaller PIL image even if max filesize not reached.
- Test resize logic against known smaller filesize (//2)
- Pass integer (not float) quality argument to PIL
- Remove Pillow from dependencies
- Implement "max_filesize" fetchart option, including
  logic to resize and rescale if maxwidth is also set.

Added tests & documentation for fetchart additions.

Tests now check that a target filesize is reached with a
higher initial quality (a difficult check to pass).

With a starting quality of 95% PIL takes 4 iterations to succeed
in lowering the example cover image to 90% its original size.
To cover all bases, the PIL loop has been changed to 5 iterations
in the worst case, and the documentation altered to reflect the
50% loss in quality this implies. This seems reasonable as users
concerned about performance would most likely be persuaded to
install ImageMagick, or remove the maximum filesize constraint.
The previous 30% figure was arbitrary.
2021-03-23 12:00:14 +01:00