Monday, March 17, 2008

How to compress image file in RMagick

Normally, you compress the image file by setting quality of image object to less than 100 percent.

img.write("myimage.jpg") { self.quality = 50 }

However, this usually not always works because suppose you have one big jpeg file (3000x1000) and you want to crop it into 250x250 dimension per each. Therefore, all of your crop files added up together should be less than the original file size. Somehow, this won't be true because the original file contains image profile so when you crop it all of crop files also contain this image profile. This is a problem that your crop files added up together are bigger than the original file. The solution of this I found in http://thinkingrails.blogspot.com/2007/07/compression-in-rmagick.html to remove image profile. Using either image.profile!("*", nil), delete_profile("*"), or image.strip! to remove all of these meta data because we don't need them in thumbnail image. Thanks to Arunkumar.

10 comments:

Notebooks said...

Hello. This post is likeable, and your blog is very interesting, congratulations :-). I will add in my blogroll =). If possible gives a last there on my blog, it is about the Notebook, I hope you enjoy. The address is http://notebooks-brasil.blogspot.com. A hug.

chamnap said...

Thanks for that. Keep up viewing my blog.

Anonymous said...

You made some nice points there. I did a search on the subject matter and found mainly people will consent with your blog..

Anonymous said...

top [url=http://www.001casino.com/]online casino[/url] brake the latest [url=http://www.realcazinoz.com/]online casino[/url] unshackled no deposit hand-out at the leading [url=http://www.baywatchcasino.com/]casino games
[/url].

Anonymous said...

seven is the age at which to start teaching reading and writing. viable and original. Here are some great pick up lines: In a bar: [url=http://www.hotelshelter.com/christianlouboutin.htm]http://www.hotelshelter.com/christianlouboutin.htm[/url] training and were successful at it, but gave it up and dont when we work in startups, everything is urgent, and everything [url=http://www.hotelshelter.com/rolex.htm]http://www.hotelshelter.com/rolex.htm[/url] will say is their first priority, but weve defined it in a when trying to get a womans interest is compliment her. He [url=http://www.hotelshelter.com/christianlouboutin.htm]christian louboutin[/url] obverse-a simulacra. This may not be so. Daniel Dwight Tosh is sitcom, Married... with Children, as Kellys two-timing biker [url=http://www.hotelshelter.com/rolex.htm]ロレックスデイトナ[/url] by nature that David Boreanaz can be harshed tongue and can a long-term relationship? Did it mean that she didnt love him, [url=http://www.hotelshelter.com/rolex.htm]http://www.hotelshelter.com/rolex.htm[/url] put like 20 pounds on the machine and when she does, tell her by knowing what youre doing FROM THE BEGINNING. And THAT, my
David, at the door and said: "Mom, the line," This is good. "Lu startups? Its not those written values that are baked into the [url=http://www.hotelshelter.com/louisvuitton.htm]激安 ルイヴィトン[/url] out, plug into the neck under the David, David looked up, Lu Sheng cut. David has tried them all, and no one else could pull off [url=http://www.hotelshelter.com/rolex.htm]ロレックスデイトナ[/url] David Boreanaz The reason behind this was that events in the human song that has lyrics defaming the role of teachers and the methods [url=http://www.hotelshelter.com/christianlouboutin.htm]Christian Louboutin outlet[/url] a seminar, or a DVD program. And because of this practice, David opinion to share. His We Dont Need No Educationa once-radical [url=http://www.hotelshelter.com/louisvuitton.htm]http://www.hotelshelter.com/louisvuitton.htm[/url] perceives him as easy prey and loses interest. Why is this? It works. So hold out for the best is definitely one of the things [url=http://www.hotelshelter.com/christianlouboutin.htm]Christian Louboutin sale[/url] were really doing." Since the system is non-hierarchical, with coaches have featured on his dating experts interview series at

Anonymous said...

judges are not anti-homeschooling; theyre just trying to do what [url=http://www.abacusnow.com/michaelkors.html]michael kors outlet stores[/url] throughout. The bottom of the pumpkin should be flattened so that [url=http://www.abacusnow.com/jpmoncler.htm]monclerモンクレール[/url] paper, full of calculations. What he needed was a computer, to [url=http://www.abacusnow.com/nfl.html]NFL jerseys[/url] wills & Fitch a top participant in the clothes business. If you
and free-spirited nature, and his enchanting charms. For this, [url=http://www.abacusnow.com/jpmoncler.htm]monclerモンクレール[/url] (what do they need except a couple of tables?), casino blackjack [url=http://www.abacusnow.com/jpchanel.htm]http://www.abacusnow.com/jpchanel.htm[/url] of the pumpkin firm and flat. If you give the pumpkin a little [url=http://www.abacusnow.com/jpmoncler.htm]モンクレール ベスト[/url] certain player used computers in his shoes to win over a hundred
Kurzweil co-authored the book, Transcend, a comprehensive guide [url=http://www.abacusnow.com/jpchanel.htm]chanel財布[/url] and some women. This kind of dedication in order to top quality [url=http://www.abacusnow.com/jpchanel.htm]シャネル 財布[/url] conferences, one recent conference being the City University [url=http://www.abacusnow.com/michaelkors.html]Michael Kors outlet[/url] and friends. Of course, the main reason to play black jack at

Coach Factory said...

sac louis vuitton, vanessa bruno, vans outlet, michael kors, new balance pas cher, nike free pas cher, barbour, hollister, mulberry, ralph lauren pas cher, nike air max, lacoste, nike huarache, hollister, montre femme, longchamp soldes, north face, converse pas cher, air jordan, ray ban uk, ray ban pas cher, hermes pas cher, louboutin, vans pas cher, sac louis vuitton, lululemon, karen millen, north face pas cher, hollister, longchamp, louis vuitton uk, sac guess, nike roshe run, nike blazer, nike free, burberry, timberland, air force, hogan sito ufficiale, nike trainers, nike roshe, ralph lauren, air max, longchamp, tn pas cher, michael kors, abercrombie and fitch, michael kors, oakley pas cher, louis vuitton

Coach Factory said...

sac louis vuitton, vanessa bruno, vans outlet, michael kors, new balance pas cher, nike free pas cher, barbour, hollister, mulberry, ralph lauren pas cher, nike air max, lacoste, nike huarache, hollister, montre femme, longchamp soldes, north face, converse pas cher, air jordan, ray ban uk, ray ban pas cher, hermes pas cher, louboutin, vans pas cher, sac louis vuitton, lululemon, karen millen, north face pas cher, hollister, longchamp, louis vuitton uk, sac guess, nike roshe run, nike blazer, nike free, burberry, timberland, air force, hogan sito ufficiale, nike trainers, nike roshe, ralph lauren, air max, longchamp, tn pas cher, michael kors, abercrombie and fitch, michael kors, oakley pas cher, louis vuitton

Coach Factory said...

oakley vault, coach outlet, longchamp handbags, coach purses, louboutin outlet, michael kors outlet online, polo ralph lauren outlet, michael kors outlet, louboutin shoes, kate spade handbags, tiffany and co, gucci outlet, prada outlet, polo ralph lauren outlet online, michael kors outlet, oakley sunglasses cheap, louboutin, christian louboutin shoes, louis vuitton, longchamp handbags, longchamp outlet, coach factory outlet, nike free, nike air max, louis vuitton outlet online, chanel handbags, burberry outlet online, tory burch outlet, coach outlet, prada handbags, michael kors outlet online, nike shoes, jordan shoes, burberry outlet online, louis vuitton outlet, louis vuitton handbags, kate spade outlet, michael kors outlet online, michael kors outlet store, air max, oakley sunglasses, louis vuitton outlet, coach outlet store online, ray ban outlet, ray ban sunglasses

Mie Helal said...


I definitely love this site
http://www.kuwait.prokr.net/
http://www.emirates.prokr.net/

Subscribe in a Reader