Sha256: ff830e8455fb4bb6e911915622c6270e856f40fb3253882db633ae7ac05f714e

Contents?: true

Size: 471 Bytes

Versions: 5

Compression:

Stored size: 471 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

5 entries across 5 versions & 1 rubygems

Version Path
image_optim-0.31.4 spec/images/invisiblepixels/generate
image_optim-0.31.3 spec/images/invisiblepixels/generate
image_optim-0.31.2 spec/images/invisiblepixels/generate
image_optim-0.31.1 spec/images/invisiblepixels/generate
image_optim-0.31.0 spec/images/invisiblepixels/generate