Skip to content

Enhancement: add tiled Buffer (and Stream) output #2238

Closed
@lovell

Description

@lovell

Will use vips_dzsave_buffer, forces container property to have a value of "zip".

Requires exposing the basename property (libvips default is "undefined").

👇 PROPOSED API - NOT YET AVAILABLE available in v0.31.0

const zipFileWithTiles = await sharp(input)
  .tile({ basename: "tiles" })
  .toBuffer();
const iiififier = sharp().tile({ layout: "iiif" });

readableStream
  .pipe(iiififier)
  .pipe(writeableStream);

☝️ PROPOSED API

Activity

Talbot3

Talbot3 commented on Aug 18, 2020

@Talbot3

Thank your tips.here is my code that run pass.

const img = require('sharp');
const fs = require('fs');
const imgStream = img().tile().toFormat('jpg').resize(320, 240);
console.log(imgStream.format)
const path = require('path');
let rStream = fs.createReadStream(path.join(__dirname, 'test.jpg').toString());
let wStream = fs.createWriteStream('./test.haha.jpg');
rStream.pipe(imgStream).pipe(wStream);
lovell

lovell commented on Aug 18, 2020

@lovell
OwnerAuthor

@Talbot3 This future possible enhancement is about Streaming a zip file containing multiple tile-based deep zoom (image pyramid) images with complete directory structure. The use of toFormat('jpg') in your sample code means it will only output one image.

nikolay-atypon

nikolay-atypon commented on Sep 25, 2020

@nikolay-atypon
manfwh

manfwh commented on Sep 25, 2021

@manfwh
lovell

lovell commented on Jul 24, 2022

@lovell
OwnerAuthor

Commit b46ab51 adds support for tile output via Stream and Buffer. This will be in v0.31.0.

added this to the v0.31.0 milestone on Jul 24, 2022
lovell

lovell commented on Sep 5, 2022

@lovell
OwnerAuthor

v0.31.0 now available with this improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @lovell@Talbot3@manfwh@nikolay-atypon

        Issue actions

          Enhancement: add tiled Buffer (and Stream) output · Issue #2238 · lovell/sharp