node.js - Appending images with node sharp (libvips) -


i want use vips append directory of many smaller images in 1 massive image. node module "sharp" uses libvips. there way use sharp append 2 images together? vips has "lrjoin" function don't see sharp implementation of it.

i know fastest possible way have vips append directory of images 1 big tiff. image big use imagemagick etc. because of memory issues.

edit:

i used ruby-vips join images , call vips command line tool generate dzi.

#!/usr/bin/ruby  require 'rubygems' require 'vips'  = vips::image.new(argv[1]) argv[2..-1].each {|name| = a.tbjoin(vips::image.tiff(name, :compression => :deflated))}                               a.write("output.tiff", :compression => :deflated)  system("vips dzsave output.tiff '#{argv[0]}'/output_dz.zip --overlap=0 --suffix=.jpg") 

i found code on ruby-sharp github issue , modified bit. results (just joining part) 550 4096x256 images:

real    0m17.283s user    0m47.045s sys     0m2.139s 

if ruby or python ok, try them. example:

#!/usr/bin/python  import sys gi.repository import vips  if len(sys.argv) < 3:     print("usage: join outfile in1 in2 in3 ...")     sys.exit(1)  def imopen(filename):     return vips.image.new_from_file(filename,                                     access = vips.access.sequential_unbuffered)  acc = imopen(sys.argv[2]) infile in sys.argv[3:]:     acc = acc.join(imopen(infile), vips.direction.horizontal,                    align = "centre",                    expand = true,                    shim = 50,                    background = 255)  acc.write_to_file(sys.argv[1]) 

joining 100 2000x2500 rgb tif images needs 1gb of memory , 30s or on desktop:

$ time ../join.py x.tif *.tif real    0m36.255s user    0m8.344s sys 0m3.396s $ vipsheader x.tif  x.tif: 204950x2500 uchar, 3 bands, srgb, tiffload 

most of time spent in disc io.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -