0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
PalletePNG is a pure-ruby library that make it possible to render the transparent of a pallete-based PNG in PDF by converting the color-mode of the image.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.0.0
>= 0

Runtime

~> 1.3.0
 Project Readme

PalletePNG

Gem Version Build Status

PalletePNG is a pure-ruby library that make it possible to render the transparent of a pallete-based PNG in PDF by converting the color-mode of the image.

Installation

Add this line to your application's Gemfile:

gem 'pallete_png'

And then execute:

$ bundle

Or install it yourself as:

$ gem install pallete_png

Usage

require 'pallete_png'

image = File.binread('/path/to/pallete-based-w-transparency.png')
converted_image = PalletePNG.to_transparency(image)

Exception

require 'pallete_png'

not_a_png_image = File.binread('/path/to/not_a_png.jpg')

begin
  converted_image = PalletePNG.to_transparency(not_a_png_image)
rescue PalletePNG::Image::NotPNG
  puts 'The image is not a PNG.'
end

Use with Prawn

See Example::Using in Prawn.

Supported versions

Ruby 2.2, 2.3

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/hidakatsuya/pallete_png.

License

© 2016 Katsuya HIDAKA. See MIT-LICENSE for further details.