[Koha-devel] Cover image 'thumbnail' size is bigger than 'imagefile' size

Jonathan Druart jonathan.druart at bugs.koha-community.org
Wed Dec 12 13:49:36 CET 2018


Hi Andreas,

This module has never been enhanced much and as you noticed there is
room for such enhancements :)
All of what you describe in your email makes sense to me, and I am
sure the changes will be accepted if a patch is provided.

Cheers,
Jonathan
Le mer. 12 déc. 2018 à 06:42, Andreas Roussos <arouss1980 at gmail.com> a écrit :
>
> Dear Developers,
>
> We use local cover images in our setup, and also resize the covers
> we scan to a width of 160px before uploading and attaching them to
> a Koha bibliographic record (we upload one cover per biblio).
>
> While using phpMyAdmin to view the contents of the 'biblioimages'
> table (relevant screenshot here: https://imgur.com/a/cSEVLBI), we
> noticed that the size of the BLOBs for the 'thumbnail' column was in
> some cases twice as big as that of the 'imagefile' column. In fact,
> this happens for more than 50% of uploaded covers as you can see
> from the output of the SQL queries below:
>
> mysql> SELECT COUNT( * ) AS count
>          FROM biblioimages
>         WHERE LENGTH( thumbnail ) > ( LENGTH( imagefile ) * 2 ) ;
> +-------+
> | count |
> +-------+
> |  1356 |
> +-------+
>
> mysql> SELECT COUNT( * ) AS count,
>               SUM( LENGTH( imagefile ) ) AS images_size,
>               SUM( LENGTH( thumbnail ) ) AS thumbnails_size
>          FROM biblioimages ;
> +-------+-------------+-----------------+
> | count | images_size | thumbnails_size |
> +-------+-------------+-----------------+
> |  2347 |    68323933 |       115839686 |
> +-------+-------------+-----------------+
>
> It would appear that for each 160px-wide JPG with 24-bit depth that
> we have uploaded, the 'imagefile' column has been populated with an
> PNG of 8 bit depth with the same dimensions as the uploaded file,
> whereas the 'thumbnail' column contains a 24-bit PNG image with a
> width reduced to 140 pixels.
>
> I've tracked down the creation of resized 24-bit PNGs to this code:
> https://github.com/Koha-Community/Koha/blob/master/C4/Images.pm#L182-L183
>
> Do thumbnails for covers need to be true colour (24-bit) images?
>
> Also, why is it that _scale_image() returns an image of 8-bit depth
> if the source image's dimensions are less than 600x800? (i.e. when
> no resizing is performed)
>
> Thank you in advance for your time.
>
> Kind regards,
> Andreas
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha-community.org
> http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/


More information about the Koha-devel mailing list