Sha256: 6d5144c43050ee79855ce71633971bcfb36d8ba636f026ef651c559d26cbe1c2

Contents?: true

Size: 991 Bytes

Versions: 3

Compression:

Stored size: 991 Bytes

Contents

#!/usr/bin/env ruby
require 'zlib'
require 'stringio'
require 'colorize'

require 'zpng/color'
require 'zpng/block'
require 'zpng/scan_line'
require 'zpng/chunk'
require 'zpng/image'

# see alse http://github.com/wvanbergen/chunky_png/

if $0 == __FILE__
  if ARGV.size == 0
    puts "gimme a png filename!"
  else
    img = ZPNG::Image.new(ARGV[0])
    img.dump
    puts "[.] image size #{img.width}x#{img.height}"
    puts "[.] uncompressed imagedata size=#{img.imagedata.size}"
    puts "[.] palette =#{img.palette}"
#    puts "[.] imagedata: #{img.imagedata[0..30].split('').map{|x| sprintf("%02X",x.ord)}.join(' ')}"

    require 'hexdump'
    #Hexdump.dump(img.imagedata, :width => 6)
    require 'pp'
    pp img.scanlines[0..5]
#    puts Hexdump.dump(img.imagedata[0,60])
#    img.scanlines.each do |l|
#      puts l.to_s
#    end
    puts img.to_s
    img[1,0]= ZPNG::Color.new(0,0,0)
    puts img.to_s
    File.open 'export.png','wb' do |f|
      f << img.export
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zpng-0.1.0 lib/zpng.rb
zpng-0.0.2 lib/zpng.rb
zpng-0.0.1 lib/zpng.rb