# frozen_string_literal: true require_relative 'shell_helper' module Booru module ImageProcessing class PngProcessor < Processor include ShellHelper def generate_version(dimensions, destination_path) write_log "generate_version #{dimensions} #{destination_path}" width, height = dimensions # resize PNG to desired size and optipng the resized version. ::MiniMagick::Tool::Convert.new do |cmd| cmd.resize "#{width}x#{height}" cmd << @original_path cmd << destination_path end optipng(destination_path) end def post_process write_log 'post_process' optipng(@original_path) end end end end