Sha256: 4dc03d775e56c8553747f8e0f4a868fd39f8d75d713a84d9ebff2e99ce2dec17

Contents?: true

Size: 668 Bytes

Versions: 1

Compression:

Stored size: 668 Bytes

Contents

# Copyright (c) 2020 Jean-Sebastien Gelinas, see LICENSE.txt
# frozen_string_literal: true

require 'mini_magick'

# A few random utilities
module ::TilesetTooling::Utils
  module_function

  # Generate a signature from the image data
  def image_signature(image_path)
    ::MiniMagick::Tool::Identify.new do |identity|
      identity.quiet
      identity.format('%#\\n')
      identity << image_path
    end
  end

  # Gets the path to the spec file that should go with the given image
  def image_spec_file_path(image_path)
    file_name = ::File.basename(image_path, '.*')
    directory = ::File.dirname(image_path)

    "#{directory}/#{file_name}.specs"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tileset_tooling-0.0.2 lib/tileset_tooling/utils.rb