Bug 33857 - Reduce and resize local cover images
Summary: Reduce and resize local cover images
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Hinemoea Viault
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-29 16:15 UTC by Hinemoea Viault
Modified: 2023-10-12 16:01 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Image to download (172.47 KB, image/jpeg)
2023-05-29 16:15 UTC, Hinemoea Viault
Details
Bug 33857: Resize local cover images (2.74 KB, patch)
2023-05-29 16:48 UTC, Hinemoea Viault
Details | Diff | Splinter Review
Bug 33857: Add script to resize cover images (2.78 KB, patch)
2023-05-30 16:11 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33857: Add script to resize cover images (1.80 KB, patch)
2023-06-13 15:21 UTC, Hinemoea Viault
Details | Diff | Splinter Review
Bug 33857: Change output messages (1.79 KB, patch)
2023-06-13 15:40 UTC, Hinemoea Viault
Details | Diff | Splinter Review
Bug 33857: Change output messages (1.79 KB, patch)
2023-06-13 16:41 UTC, Hinemoea Viault
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Hinemoea Viault 2023-05-29 16:15:30 UTC
Created attachment 151780 [details]
Image to download

When the local cover images are imported from very large photos or images, they do not seem to be worked before being put in the database.

To reproduce:

1. Download the attached image large-image.jpg
  --> It should be ~170kB and 1000×1500 pixels
2. Enable LocalCoverImages in System preferences
3. Find a record in the staff interface
4. Go to "Images" tab
5. Upload large-image.jpg image
   5.1. Click on "Upload"
   5.2. Click on "Drop files here or click to select a file"
   5.3. Choose picture (large-image.jpg)
   5.4. Click on "Process images"
6. Click on image for large image
7. Right-click on the image and save it
  --> It is ~930kB and 600x900 pixels
Comment 1 Hinemoea Viault 2023-05-29 16:48:54 UTC
Created attachment 151781 [details] [review]
Bug 33857: Resize local cover images

This patch add a script in ./misc/maintenance/ that allows to reduce and resize local cover images.

Test plan: 

1. Download the attached image large-image.jpg
  --> It should be ~170kB and 1000×1500 pixels
2. Enable LocalCoverImages in System preferences
3. Find a record in the staff interface
4. Go to "Images" tab
5. Upload large-image.jpg image
   5.1. Click on "Upload"
   5.2. Click on "Drop files here or click to select a file"
   5.3. Choose picture (large-image.jpg)
   5.4. Click on "Process images"
6. Click on image for large image
7. Right-click on the image and save it
  --> It is ~930kB and 600x900 pixels 

8. Apply the patch

9. In the terminal, run the script resize_cover_images.pl
   9.1. Before running the script you need to run the following lines
     --> sudo apt install imagemagick
     --> sudo apt install libimage-magick-perl
   9.2. Run resize_cover_images.pl
     --> perl ./misc/maintenance/resize_cover_images.pl
10. Repeat steps 6 and 7
   --> The image is ~200kB and 267x400 pixels
Comment 2 Sam Lau 2023-05-30 16:11:14 UTC
Created attachment 151810 [details] [review]
Bug 33857: Add script to resize cover images

Signed-off-by: Sam Lau <samalau@gmail.com>
Comment 3 Caroline Cyr La Rose 2023-06-12 20:05:55 UTC
I think there may be a problem with the signoff? It seemed to create a second patch without obsoleting the first? I don't know enough to pinpoint the reason, but I don't think that there should be two patches...
Comment 4 Hinemoea Viault 2023-06-13 15:21:18 UTC
Created attachment 152307 [details] [review]
Bug 33857: Add script to resize cover images
Comment 5 Hinemoea Viault 2023-06-13 15:40:29 UTC
Created attachment 152308 [details] [review]
Bug 33857: Change output messages
Comment 6 Hinemoea Viault 2023-06-13 16:41:08 UTC
Created attachment 152313 [details] [review]
Bug 33857: Change output messages
Comment 7 Manos PETRIDIS 2023-07-07 14:55:49 UTC
In my experience the problem arises from the change of format from JPEG to PNG. There should be a way to contain file size, without compromising pixel size. One could tamper for example with JPEQ quality index. Please see bug 33143 for  examples.
Comment 8 Manos PETRIDIS 2023-07-10 09:34:35 UTC
Has noone noticed that in the test example we begin with a full size image (1000×1500 pixels) with a filesize of only ~170kB and after running resize_cover_images.pl we end up with a greatly reduced quality image (267x400 pixels) having an increased filesize? 

Is this sane practice, aren't we trying to reduce the filesize and its impact on database size? In the test example, we'd be better off leaving the image in its initial status.

Please also check Bug 31049 - Add tool to set/reduce local cover image size and quality, interactively and in batch.
Comment 9 Jonathan Druart 2023-08-03 10:46:12 UTC
Manos is right, we should fix the original problem instead of doing this.
Comment 10 Jonathan Druart 2023-08-03 10:47:22 UTC
See bug 33143, bug 31049, bug 23963 and bug 22988.
Comment 11 Marcel de Rooy 2023-09-29 09:40:37 UTC
(In reply to Jonathan Druart from comment #9)
> Manos is right, we should fix the original problem instead of doing this.

Why not use FQA to keep the queue cleaner?
Comment 12 Manos PETRIDIS 2023-10-12 15:18:59 UTC
(In reply to Jonathan Druart from comment #10)
> See bug 33143, bug 31049, bug 23963 and bug 22988.

Please consider voting for the bugs you consider important. It's available next to "Importance" drop-down list.

FQA? https://www.acronymfinder.com/FQA.html
Comment 13 Jonathan Druart 2023-10-12 16:01:10 UTC
(In reply to Manos PETRIDIS from comment #12)
> FQA? https://www.acronymfinder.com/FQA.html

"Failed QA" in this context.