144 Commits

Author SHA1 Message Date
John Cupitt
03f76b73b4 add "premultiply" param to tiffsave
Some programs, like indesign, only work with premultiplied alpha in TIFF. To
make TIFFs which are compatible with these programs, we'll need an extra
TIFF save flag (perhaps premultiply?) to premultiply alpha and save as
EXTRASAMPLE_ASSOCALPHA.

see https://github.com/libvips/libvips/issues/2192
2021-05-01 20:08:06 +01:00
John Cupitt
7603c4b6ab fix some small bugs
- disable chroma subsample for jp2k-in-tiff ... it didn't work due to opj bugs
- revise numresolutions setting
- require opj 2.4 or later
2021-04-30 10:42:32 +01:00
John Cupitt
edcdf8af70 rebase add-jp2ktiff on master 2021-04-26 15:16:20 +01:00
John Cupitt
b14bac53a3 guard refs to ZSTD
so we work on older libtiffs
2021-03-05 12:16:38 +00:00
John Cupitt
495b54dfcf grou predictor settings 2021-03-04 17:31:08 +00:00
AdiosF6F
4d0252f31c
add tiff zstd predictor support 2021-03-04 22:38:47 +08:00
John Cupitt
86a6fd9d18 fix tiff deflate predictor setting
the enums were mixed up, thanks Adios

see https://github.com/libvips/libvips/issues/2128
2021-03-04 09:39:50 +00:00
John Cupitt
85f3ac6d8f fix tiff pyramid save region-shrink
we'd forgotton to connect it up

thanks imgifty

see https://github.com/libvips/libvips/issues/1875
2020-11-03 23:14:44 +00:00
John Cupitt
fcaba0e6ba add @profile to webpsave
small tiffsave fixes too
2020-07-18 14:49:37 +01:00
Kleis Auke Wolthuizen
9246094033 Fix function pointer cast issues
It is undefined behavior in C and C++ to cast a function pointer
to another type and call it that way. This does work in most native
platforms, however, despite it being UB, but in WASM it can fail.

See:
https://emscripten.org/docs/porting/guidelines/function_pointer_issues.html
2020-06-30 13:35:41 +02:00
John Cupitt
b2feb4805f fix flush of left-over bits
we were not adjusting for pixel size, thanks MathemanFlo

see https://github.com/libvips/libvips/pull/1672#issuecomment-644807739
2020-06-18 14:54:09 +01:00
John Cupitt
3b07f72b67 revise bit packing funcs in vips2tiff
smaller, simpler
2020-06-17 14:28:13 +01:00
John Cupitt
19077b53ac revise tiff2vips 1/2/4 bit load
simpler, faster, smaller
2020-06-17 13:59:02 +01:00
John Cupitt
8b469b4516 adjust formatting of 2, 4 bit tiff load/save
To make it libvipsey. Small fixes as well.
2020-06-16 18:58:27 +01:00
Florian Heinrich
0f0e8cb677 Fixed typo in bitdepth code 2020-06-16 16:27:11 +02:00
Florian Heinrich
00bd91a3c4 Fixed issues with bitdepth 2020-06-16 16:21:52 +02:00
Florian Heinrich
035e0bc756 Added read and write functionality for 2 and 4 bit greyscale TIF images 2020-06-09 11:23:28 +02:00
John Cupitt
d5eecac88c add note about plane separate write 2020-06-05 12:14:40 +01:00
John Cupitt
460e1d0bf5 set n-subifds for tiff files
says how many subifds in the first page
2020-06-01 17:22:10 +01:00
John Cupitt
d16f1e67dd fix tile clipping in toilet roll images
we were not clipping unaligned tiled correctly
2020-06-01 13:22:51 +01:00
John Cupitt
39af6c21c8 update notes 2020-06-01 00:55:19 +01:00
John Cupitt
0bdd2290a0 fix tiff directory mixup
we were not always selecting the correct read directory
2020-06-01 00:39:15 +01:00
John Cupitt
aaebb3b346 fix thumbnail of mono image
we were using RGB as the shrink space
2020-05-27 15:24:27 +01:00
John Cupitt
474bfe3782 pytest and valgrind pass
remove some dbg code
2020-05-24 17:04:55 +01:00
John Cupitt
a2d196b736 add subifd support to the TIFF writer
A new subifd switch enables the writing of pyramids layers into subifds
(rather than the default successive pages). This switch is enabled
automatically for multi-page pyramids.

seems to work in quick tests
2020-05-24 15:21:41 +01:00
John Cupitt
84b9d1f638 seems to make an OME pyramid correctly
```
$ vips tiffsave ../k2.jpg x.tif --tile --pyramid --subifd && tiffinfo x.tif
TIFF Directory at offset 0x900008 (9437192)
  Image Width: 1450 Image Length: 2048
  Tile Width: 128 Tile Length: 128
  Resolution: 72.009, 72.009 pixels/inch
  Bits/Sample: 8
  Sample Format: unsigned integer
  Compression Scheme: None
  Photometric Interpretation: RGB color
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 3
  Planar Configuration: single image plane
  SubIFD Offsets: 11797898 12388230 12585130 12634526     0
```
2020-05-15 17:16:04 +01:00
John Cupitt
7deead8911 add a subifd flag to tiffsave 2020-05-13 12:45:28 +01:00
John Cupitt
03399b4d7e tiff write sets page number
tiffsave sets `PAGENUMBER` and `FILETYPE_PAGE`, thanks jclavoie-jive

see https://github.com/libvips/libvips/issues/1565
2020-03-08 11:06:19 +00:00
John Cupitt
a158b15b97 add LOGLUV TIFF support
libvips XYZ images load and save as libtiff LOGLUV

see https://github.com/libvips/libvips/issues/1506
2020-01-29 17:47:08 +00:00
John Cupitt
42930e8d87 add "depth" param to tiffsave
Add a "depth" param to tiffsave to set pyramid depth, just like the
"depth" param on dzsave.

See https://github.com/libvips/libvips/issues/1485
2020-01-26 18:39:47 +00:00
John Cupitt
252996e3ff make check passes after stream -> source rename 2019-12-30 12:48:20 +00:00
John Cupitt
4c5873809f experiment with renaming stream
rename as VipsConnection, VipsSource, VipsTarget etc.

see https://github.com/libvips/libvips/issues/1494#issuecomment-569498619

renamed with this script:

```

set -e

edit() {
        sed -i -E "$1" rename
}

for i in $*; do
        cp $i rename

        edit s/VIPS_STREAMOU/VIPS_TARGET_CUSTOM/g
        edit s/VIPS_STREAMO/VIPS_TARGET/g
        edit s/VIPS_STREAMIU/VIPS_SOURCE_CUSTOM/g
        edit s/VIPS_STREAMI/VIPS_SOURCE/g
        edit s/VIPS_STREAM/VIPS_CONNECTION/g

        edit s/vips_streamou/vips_target_custom/g
        edit s/vips_streamo/vips_target/g
        edit s/vips_streamiu/vips_source_custom/g
        edit s/vips_streami/vips_source/g
        edit s/vips_stream/vips_connection/g

        edit s/VipsStreamou/VipsTargetCustom/g
        edit s/VipsStreamo/VipsTarget/g
        edit s/VipsStreamiu/VipsSourceCustom/g
        edit s/VipsStreami/VipsSource/g
        edit s/VipsStream/VipsConnection/g

        # eg. VIPS_TYPE_STREAM or VIPS_IS_STREAM
        edit "s/VIPS_([A-Z]+)_STREAMOU/VIPS_\1_TARGET_CUSTOM/g"
        edit "s/VIPS_([A-Z]+)_STREAMO/VIPS_\1_TARGET/g"
        edit "s/VIPS_([A-Z]+)_STREAMIU/VIPS_\1_SOURCE_CUSTOM/g"
        edit "s/VIPS_([A-Z]+)_STREAMI/VIPS_\1_SOURCE/g"
        edit "s/VIPS_([A-Z]+)_STREAM/VIPS_\1_CONNECTION/g"

        edit s/streamou/target_custom/g
        edit s/streamo/target/g
        edit s/streamiu/source_custom/g
        edit s/streami/source/g

        # various identifiers which also change
        edit s/is_a_stream/is_a_source/g
        edit s/find_load_stream/find_load_source/g
        edit s/find_save_stream/find_save_target/g
        edit s/new_from_stream/new_from_source/g
        edit s/write_to_stream/write_to_target/g
        edit s/vips_thumbnail_stream/vips_thumbnail_source/g

        # eg. vips_webpload_stream
        edit "s/vips_([a-z]+)load_stream/vips_\1load_source/g"

        # eg. vips_webpsave_stream
        edit "s/vips_([a-z]+)save_stream/vips_\1save_target/g"

        mv rename $i
done
```
2019-12-29 21:40:21 +00:00
John Cupitt
e1baf66f19 "squash" to tiffsave now does lab as well
The "squash" option to tiffsave now also squashes 32-bit 3-band float
CIELAB images down to 8 bits.

See https://github.com/libvips/libvips/issues/1499
2019-12-18 17:29:34 +00:00
John Cupitt
112dc9101a remove early shutdown from tiff reader
since streams do this automatically now
2019-12-13 14:19:09 +00:00
John Cupitt
6fea2e7c57 clip negatives off LABS L in tiff save
Negative L in LABS needs to be trimmed off before savingf as TIFF.
Thanks angelmixu.

See https://github.com/libvips/libvips/issues/1499
2019-12-13 12:45:49 +00:00
John Cupitt
40bffa8cc6 small reformats
plus remove save multiband as separated multiink
2019-12-07 17:41:53 +00:00
Angel Sánchez
c85454f56c Merge branch 'refs/heads/master' into improve-file-formats
# Conflicts:
#	libvips/conversion/switch.c
2019-12-04 11:49:18 +01:00
John Cupitt
562da3e5ab rename new_from_filename as new_from_file
So VipsStreami matches VipsImage. Same for new_to_filename.
2019-11-22 17:13:20 +00:00
John Cupitt
486b95eb7b
Merge branch 'master' into add-stream-object 2019-11-19 17:08:03 +00:00
Angel Sánchez
dd79cfd89d use Type/Interpretation for using the format when saving 2019-11-19 11:26:34 +01:00
Angel Sánchez
fa0514a4d4 enable separated/multiband load and save for tiff format 2019-11-13 16:16:22 +01:00
Angel Sánchez
6df26bfc9b load lab 8bit with alpha to labS 2019-11-12 18:02:52 +00:00
Angel Sánchez
64f1b60b14 Revert "fix tiff writer for labQ with more bands"
This reverts commit bb3955193daa98b35e4fc69f8ad39cbb3d0d2fa8.
2019-11-12 17:35:16 +00:00
Angel Sánchez
cce739bed9 fix tiff writer for labQ with more bands 2019-11-12 17:35:16 +00:00
John Cupitt
f5a4f41edf rename VipsStream* variables
The convention is now:

	VipStreami *streami;

We had `input` in many places, a left-over from the old VipStreamInput
name.
2019-11-11 09:09:34 +00:00
John Cupitt
ee3270f8e9 more refactoring 2019-10-22 11:08:54 +01:00
John Cupitt
226819b8a8 move tiffload to streams
test_descriptors seems to fail now though, odd
2019-10-17 10:58:56 +01:00
John Cupitt
834acad825 fix << on signed int warnings
<< on a negative number is undefined behaviour in C, and will trigger
fuzzer warnings.
2019-08-02 05:35:18 +01:00
John Cupitt
52ee3b083f add webp and zstd support to tiffsave
needs some tests still
2019-07-08 10:39:44 +01:00
John Cupitt
dc16f1253a fix a memleak in tiff pyr to memory
we were not freeing layers other than the top layer
2019-06-06 10:20:14 +01:00