Islandora / documentation

Contains islandora's documentation and main issue queue.
MIT License
103 stars 71 forks source link

PDF thumbnails should be PNG for transparency #1260

Closed kayakr closed 4 years ago

kayakr commented 5 years ago

In my experience, JPEG thumbnails from PDFs often end up with black backgrounds. Compare 2-Thumbnail Image to ead3_output_thumbnail-0

The latter .png was generated on the command line in the VM using sudo convert -thumbnail x300 -background white -alpha remove /var/www/html/drupal/EAD3_Implementation_Survey_Results_and_Discussion_20190320.pdf ead3_output_thumbnail.png

I assume the way to do this is to clone action 'Image - Generate a thumbnail from an original file', change mimetype to image/png and alter the contexts so that the original 'Image - Generate a thumbnail from an original file' action only applies to model=Image, while the new action applies when model=Document?

dannylamb commented 5 years ago

Yep, that's totally how it would work. And I can also attest that I've seen black backgrounds from generated jpegs in the past. :+1: Good suggestion.

On Sun, Sep 1, 2019, 19:45 J Hunt notifications@github.com wrote:

In my experience, JPEG thumbnails from PDFs often end up with black backgrounds. Compare

https://camo.githubusercontent.com/839e868583a7dc6a9dc13f478172c9c5c0206b92/687474703a2f2f6c6f63616c686f73743a383030302f73697465732f64656661756c742f66696c65732f323031392d30382f322d5468756d626e61696c253230496d6167652e6a7067

https://camo.githubusercontent.com/1f788630a530e7e5bf33169ac7cc7c294027f4dd/687474703a2f2f6c6f63616c686f73743a383030302f73697465732f64656661756c742f66696c65732f656164335f6f75747075745f7468756d626e61696c2d302e706e67 The latter .png was generated on the command line in the VM using sudo convert -thumbnail x300 -background white -alpha remove /var/www/html/drupal/EAD3_Implementation_Survey_Results_and_Discussion_20190320.pdf ead3_output_thumbnail.png

I assume the way to do this is to clone action 'Image - Generate a thumbnail from an original file', change mimetype to image/png and alter the contexts so that the original 'Image - Generate a thumbnail from an original file' action only applies to model=Image, while the new action applies when model=Document?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Islandora-CLAW/CLAW/issues/1260?email_source=notifications&email_token=AE6PSH42KCLWA3CAFSI3CCTQHRA2HA5CNFSM4ISYG6S2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HIVLUYQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AE6PSHZV6W5YZR45JT64QULQHRA2HANCNFSM4ISYG6SQ .

kayakr commented 5 years ago

web/modules/contrib/islandora_defaults/config/install/system.action.digital_document_generate_a_thumbnail_from_an_original_file.yml

langcode: en
status: true
dependencies:
  module:
    - islandora_image
id: digital_document_generate_a_thumbnail_from_an_original_file
label: 'Digital Document - Generate a thumbnail from an original file'
type: node
plugin: generate_image_derivative
configuration:
  queue: islandora-connector-houdini
  event: 'Generate Derivative'
  source_term_uri: 'http://pcdm.org/use#OriginalFile'
  derivative_term_uri: 'http://pcdm.org/use#ThumbnailImage'
  mimetype: image/png
  args: '-thumbnail 100x100'
  destination_media_type: image
  scheme: public
  path: '[date:custom:Y]-[date:custom:m]/[node:nid]-[term:name].png'

This is working for me, manually via admin/content. Next we need to tweak contexts.