GithubHelp home page GithubHelp logo

amberbit / prawn-fast-png Goto Github PK

View Code? Open in Web Editor NEW
30.0 5.0 23.0 178 KB

An extension of Prawn that improves the performance when embedding PNG images containing an alpha channel

Home Page: http://amberbit.com/code

License: Other

Ruby 100.00%

prawn-fast-png's Introduction

prawn-fast-png

An extension of Prawn that improves the performance when embedding PNG images containing an alpha channel. Uses RMagick to separate RGB and alpha channels.

Usage

This gem doesn’t introduce any API changes, so please refer to Prawn’s RDoc.

require 'prawn'
require 'prawn/fast_png'

pdf = Prawn::Document.new
pdf.image 'dice.png'
pdf.render_file 'example.pdf'

Running Prawn’s tests

cd path_to_prawn_src
git tag # available versions
git checkout version.tag
# or
git checkout master
cd -
rake test PRAWN_DIR=path_to_prawn_src

for versions 0.5.1-0.8.3 add PRAWN_REQUIRE=prawn/core option

rake test PRAWN_DIR=path_to_prawn_src PRAWN_REQUIRE=prawn/core

GitHub

github.com/amberbit/prawn-fast-png

Mailing list

groups.google.com/group/prawn-ruby

Credits

prawn-fast-png is maintained by Wojciech Piekutowski, and is funded by AmberBit.

prawn-fast-png's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

prawn-fast-png's Issues

Notes about Prawn 1.0 roadmap

Hello!

Thanks for building an extension to Prawn. I'm filing this issue to let you know that we're currently working towards a stable 1.0 release of Prawn, and I want to invite you to be part of the discussion around that.

We will only have one more major release before 1.0 is shipped: it will be labeled 0.15 and it will be cut on 2014-02-16.

The functionality of the 0.15 release will be largely the same as what we ship in 1.0, so if you want to test your project against the newest Prawn code, that would be a good time to
do it. You can also get a head start by trying out what is on master now, and reporting any problems you encounter.

If your project is sufficiently up to date and is able to run on the latest Prawn code, the next step would be to take a look at our API compatibility plans, which are described in detail here:

https://groups.google.com/forum/#!topic/prawn-ruby/dbTSnlDhED0

Here's the very quick summary:

  • If your project is using stable APIs and ONLY stable APIs, it will be safe for you to lock your Prawn dependency to "~> 1.0".
  • If your project is using stable and extension APIs, keep an eye out for deprecation warnings, and lock your gem to
    a range of known good minor Prawn versions. (i.e. ">= 1.0", "<=1.x"). We want to eventually apply semantic versioning to our extension API as well, but we're not there yet.
  • The use of experimental APIs in your extensions is not recommended unless you consider your own code to be experimental as well. Instead, work with us to figure out what it would take to get these experimental APIs stabilized or extracted.

I know this is a little bit confusing, and my hope is that in the not too distant future we'll be able to cut a Prawn 2.0 release that has much better support for downstream dependencies.

Until that time, what we lack in stability we'll try to make up in support for your project. Use the Prawn mailing list to contact us about any concerns or breakage, help us work on API stabilization, and let us know when you need extension points to support your project.

Thanks!
-greg

Permission issue

Hi there,

The gem's main file fast_png.rb is set to be readable just by owner and group:

$ ls -l /opt/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/prawn-fast-png-0.2.3/lib/prawn
insgesamt 8
-rw-r----- 1 root root  169 16. Jul 15:50 fast_png.rb
drwxr-xr-x 2 root root 4096 16. Jul 15:50 images

If someone installs gems as root (as I do) in order to make them available to other users, this is bad because Ruby doesn't find the file:

irb(main):001:0> require "prawn"
=> true
irb(main):002:0> require "prawn/fast_png"
LoadError: no such file to load -- prawn/fast_png
    from /opt/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
    from /opt/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
    from /opt/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from (irb):2
    from /opt/rubies/ruby-1.9.2-p290/bin/irb:12:in `<main>'
irb(main):003:0> 

OS: Arch Linux
ruby -v: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
RubyGems version: 1.8.5

Valete,
Quintus

RMagick -> Graphicsmagick

I created the Graphicsmagick gem as a simple wrapper for the GraphicsMagick CLI. I saw significant performance increases in our tasks when we switched from ImageMagick to GraphicsMagick, and then again from RMagick to this gem.

I'm using prawn-fast-png in one of my projects, and would really love to keep using it while still not using ImageMagick or RMagick. I've done a little research into this, but I can't seem to find what the CLI commands are for export_pixels and export_pixels_to_str. Do you know what they are?

Magick::Image.from_blob TypeError: can't convert nil into String

RMagick 2.11.0
prawn 0.5.0.1

@prawn_fast_png_data is being passed to Magick::Image.from_blob as nil which causes the TypeError on the method.

Maybe I don't understand how this is supposed to work, but it seems that setting the instance variable back to nil after running the aliased initialize will always cause this to be the case.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.