From: Paul Duncan Date: 2002-12-25T07:17:04+09:00 Subject: Re: creating on the fly jpgs/pngs etc --wZdghQXYJzyo6AGC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Brad Cox (bcox@virtualschool.edu) wrote: > At 01:37 AM +0900 12/25/02, me wrote: > >I want to create jpgs on the fly but I dont see any module for this. The= re > >is a ruby/GD module but it has to be build from ruby source which Im > >disinclined to do. Are there any other solutions anyone knows of? >=20 > Very lightweight jpgs or heavy-weight flies? ;) Imlib2-Ruby can create jpgs on the fly. pabs@vault:~/proj/jpg> cat ./jpg.rb=20 #!/usr/bin/ruby=20 require 'imlib2' im =3D Imlib2::Image.new 640, 480 im.fill_rect 0, 0, 640, 480, Imlib2::Color::RED begin im.save 'output.jpg' rescue $stderr.puts "Couldn't save output.jpg: #$!" end pabs@vault:~/proj/jpg> ./jpg.rb pabs@vault:~/proj/jpg> file ./output.jpg=20 =2E/output.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, 1 x 1 pabs@vault:~/proj/jpg>=20 Caveats: Only works under Unix variants (Linux, FreeBSD, etc), and Imlib2 itself is not really being actively developed any more (although there are bugfixes etc). Anyway, Imlib2-Ruby is available at http://www.pablotron.org/software/imlib2-ruby/ if you want to check it out (and there are packages available for Debian, as well as a FreeBSD port). I'm looking at wrapping another popular image processing library, but I haven't started on that yet. > Seriously, I know of nothing like this for ruby but haven't looked=20 > hard either. Java has this but it was a real bear to use last time I=20 > looked. > --=20 >=20 > Brad Cox, PhD; bcox@virtualschool.edu 703 361 4751 http://virtualschool.e= du > o For industrial age goods there were checks and credit cards. > For everything else there is http://virtualschool.edu/mybank > o Java Web Application Architecture: http://virtualschool.edu/jwaa > o Ruby Interactive Learning Environment http://virtualschool.edu/ile > o Support Israel and Palestine: http://virtualschool.edu/mideast --=20 Paul Duncan pabs in #gah (OPN IRC) http://www.pablotron.org/ OpenPGP Key ID: 0x82C29562 --wZdghQXYJzyo6AGC Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+CNzczdlT34LClWIRAjzNAKCFDDuTUfaMzj0qrvgXsTzSILfh7wCcDmH5 aCl4eSV0LfbcXfn2gs6EHaU= =l9IB -----END PGP SIGNATURE----- --wZdghQXYJzyo6AGC--