LibTIFF 4.6.0 dropped support for tiff2ps and tiff2pdf
Brought to you by:
ra28145
Gentoo has stabilised tiff-4.6.0, therefore to stop users having run-time problems with tiff2ps not being present (despite libtiff being installed. tiffcp is still there) I am considering doing:
--- a/lib/Gscan2pdf/Dialog/Save.pm
+++ b/lib/Gscan2pdf/Dialog/Save.pm
@@ -570,10 +570,6 @@ sub add_image_type {
$label = Gtk3::Label->new( __('Postscript backend') );
$hboxps->pack_start( $label, FALSE, FALSE, 0 );
my @backends = (
- [
- 'libtiff', __('LibTIFF'),
- __('Use LibTIFF (tiff2ps) to create Postscript files from TIFF.')
- ],
[
'pdf2ps',
__('Ghostscript'),
--- a/lib/Gscan2pdf/Document.pm
+++ b/lib/Gscan2pdf/Document.pm
@@ -4471,22 +4471,7 @@ sub _thread_save_tiff {
'Save file', sprintf __('Error compressing image: %s'), $error );
return;
}
- if ( defined $options{options}{ps} ) {
- $self->{message} = __('Converting to PS');
- @cmd = ( 'tiff2ps', '-3', $options{path}, '-O', $options{options}{ps} );
- ( $status, undef, $error ) = exec_command( \@cmd, $options{pidfile} );
- if ( $status or $error ) {
- $logger->info($error);
- _thread_throw_error( $self, $options{uuid}, $options{page}{uuid},
- 'Save file',
- sprintf __('Error converting TIFF to PS: %s'), $error );
- return;
- }
- _post_save_hook( $options{options}{ps}, %{ $options{options} } );
- }
- else {
- _post_save_hook( $options{path}, %{ $options{options} } );
- }
+ _post_save_hook( $options{path}, %{ $options{options} } );
$self->{return}->enqueue(
{
If possible a review of whether that looks safe would be great. I haven't managed to crash it.
I've been running the tests against it. Found that tiff2pdf in the tests can mostly be replaced by convert, here it is, in case of interest, https://sourceforge.net/p/gscan2pdf/code/merge-requests/38/. Although not 1628_import_pdf_metadata.t
as I don't think convert can set the metadata, or 135_save_tiff_as_ps_with_space.t
which looks like it needs tiff2ps.
I don't see a problem with your patch. Thanks for the heads up.
It is a shame that libtiff has dropped support for most of the tools. If I had time, I'd rewrite them in Rust.
FYI - ATM I am in the process of rewriting gscan2pdf in Python, as the Python support for Gtk4 is much better. I'm planning to name the rewrite "scantpaper"
Thanks for reviewing. That is just a quick fix to keep us going - while looking forward to the Python. Having ported something else which draws on a Widget from GTK 3 to 4, definitely better with 4.
Apparently the tools are going to return in 4.7.0:
https://gitlab.com/libtiff/libtiff/-/blob/master/doc/rfcs/rfc2_restoring_needed_tools.rst?ref_type=heads
A consolidated patch is attached. It is based on Chris' work. It deals with all the code and tests. I had to delete t/135_save_tiff_as_ps_with_space.t as pstopdf crashes for me in ghostscript-10.03.1.