Sha256: 56b03a1dfbc60c454fe7b3d517cb38d4bf50bb5ce5a05029c7c6477a2a573ae4

Contents?: true

Size: 467 Bytes

Versions: 7

Compression:

Stored size: 467 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

Dir.chdir(File.dirname(__FILE__))

require 'shellwords'

side = 64

IO.popen(%W[
  convert
  -depth 8
  -size #{side}x#{side}
  -strip
  rgba:-
  PNG32:image.png
].shelljoin, 'w') do |f|
  side.times do |a|
    side.times do |b|
      alpha = [0, 1, 0x7f, 0xff][(a / 8 + b / 8) % 4]
      f << [rand(256), rand(256), rand(256), alpha].pack('C*')
    end
  end
end
system 'image_optim --pngcrush-blacken=n image.png'

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
image_optim-0.30.0 spec/images/invisiblepixels/generate
image_optim-0.29.0 spec/images/invisiblepixels/generate
image_optim-0.28.0 spec/images/invisiblepixels/generate
image_optim-0.27.1 spec/images/invisiblepixels/generate
image_optim-0.27.0 spec/images/invisiblepixels/generate
image_optim-0.26.5 spec/images/invisiblepixels/generate
image_optim-0.26.4 spec/images/invisiblepixels/generate