-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #133 from samvera/alpha-channel-docs
Update source image docs to include alpha channel info
- Loading branch information
Showing
1 changed file
with
15 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,32 @@ | ||
import { Callout } from 'nextra/components' | ||
|
||
# Source Images | ||
|
||
The S3 key of any given file, minus the extension, is its IIIF ID. For example, if you want to access the image manifest for the file at `abcdef.tif`, you would get `https://.../iiif/2/abcdef/info.json`. If your key contains slashes, they must be URL-encoded: e.g., `ab/cd/ef/gh.tif` would be at `https://.../iiif/2/ab%2Fcd%2Fef%2Fgh/info.json`. (This limitation could easily be fixed by encoding only the necessary slashes in the incoming URL before handing it off to the IIIF processor, but that's beyond the scope of the demo.) | ||
|
||
`iiif-processor` can use any image format _natively_ supported by [libvips](https://libvips.github.io/libvips/), including JPEG 2000 (`.jp2`), but best results will come from using tiled, multi-resolution TIFFs. The Lambda Function wrapper included in this application assumes a `.tif` extension unless you set ResolverTemplate in your .env file. | ||
|
||
<Callout emoji="⚠️"> | ||
Some versions of `libvips` and `libjpeg` have an issue with JPEG-compressed pyramidal TIFF images that include more than 3 channels (e.g., | ||
alpha channels). If you find that `serverless-iiif` returns an error for an image request or isn't rendering as you'd expect, try removing any additional channels beyond red, green, and blue. | ||
</Callout> | ||
|
||
## Creating tiled TIFFs | ||
|
||
### Using VIPS | ||
### Using the VIPS command line | ||
|
||
```bash | ||
# For a 3-channel source image | ||
vips tiffsave source_image.tif output_image.tif --tile --pyramid --compression jpeg --tile-width 256 --tile-height 256 | ||
|
||
# For a source image with an alpha channel | ||
vips extract_band source_image.tif temp_image.v 0 --n 3 \ | ||
&& vips tiffsave temp_image.v output_image.tif --tile --pyramid --compression jpeg --tile-width 256 --tile-height 256 \ | ||
&& rm temp_image.v | ||
``` | ||
|
||
### Using ImageMagick | ||
|
||
```bash | ||
convert source_image.tif -define tiff:tile-geometry=256x256 -compress jpeg 'ptif:output_image.tif' | ||
convert source_image.tif -alpha off -define tiff:tile-geometry=256x256 -compress jpeg 'ptif:output_image.tif' | ||
``` |