blob: fa63abbe9344b5a3823fa89ac06b5d7cf4740535 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# 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
|