Skip to content
/ imogen Public

Derivative generation and smart square thumbnails via libvips.

Notifications You must be signed in to change notification settings

cul/imogen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

imogen

derivative generation and smart square thumbnail via libvips.

Scale and re-format an image

  Imogen.with_image('example.tiff') do |img|
    # img is a FreeImage::BitMap
    Imogen::Scaled.convert(img, 'example-150.jpg', 150)
  end

Scale and re-format an image, using the revalidate option to skip any vips caching and re-reading in the source image

  Imogen.with_image('example.tiff', { revalidate: true }) do |img|
    # img is a FreeImage::BitMap
    Imogen::Scaled.convert(img, 'example-150.jpg', 150)
  end

Note: The revalidate option requires libvips >= 8.15.

Perform "interesting region" detection

  Imogen.with_image('example.tiff') do |img|
    # get the crop area of an "interesting region" of an image
    left_x, top_y, right_x, bottom_y = Imogen::Iiif::Region::Featured.get(img, 768)
  end

  # or

  Imogen.with_image('example.tiff') do |img|
    Imogen::AutoCrop.convert(img, 'example-150-square.jpg', 150)
  end

Convert according to IIIF parameters

  Imogen.with_image('example.tiff') do |img|
    Imogen::Iiif.convert(img, 'example-iiif-region.jpg', 'jpg', region: '50,60,500,800', size: '!100,100', quality: 'color', rotation: '!90')
  end

Build IIIF parameters for a DZI-style tileset

  Imogen.with_image('example.tiff') do |img|
    Imogen::Iiif::Tiles.for(img,'/tmp',:jpg, 128, 'default') do |image, suggested_tile_dest_path, format, opts|
      # do something
    end
  end

About

Derivative generation and smart square thumbnails via libvips.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages