# Barby and more than 72 ppi

**URL:** <https://www.ruby-forum.com/t/barby-and-more-than-72-ppi/159679>\
**Category:** Ruby\
**Created:** [February 7, 2009, 1:22am UTC](https://www.ruby-forum.com/t/barby-and-more-than-72-ppi/159679 "2009-02-07T01:22:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lis2](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/54ee81/32.png) [@lis2](https://www.ruby-forum.com/u/lis2)\
**Post date:** [February 7, 2009, 1:22am UTC](https://www.ruby-forum.com/t/barby-and-more-than-72-ppi/159679/1 "2009-02-07T01:22:42Z")

</div>

Hello.  
I need your help.  
I use barby to generate barcods (it`s great libary). However every png that generate is 72 ppi. On the screen that looks beautiful but if i want to print than i need 150 or 300 ppi. Could you tell me how to generate this image? I looked also at gbarcode but i can`t find that  
option.  
Thanks for your help

---

<div class="post-metadata">

**Author:** ![lis2](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/54ee81/32.png) [@lis2](https://www.ruby-forum.com/u/lis2)\
**Post date:** [February 8, 2009, 12:45am UTC](https://www.ruby-forum.com/t/barby-and-more-than-72-ppi/159679/2 "2009-02-08T00:45:32Z")

</div>

On Feb 7, 1:21 am, Krzysztof K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello.  
> I need your help.  
> I use barby to generate barcods (it`s great libary). However every png that generate is 72 ppi. On the screen that looks beautiful but if i want to print than i need 150 or 300 ppi. Could you tell me how to generate this image? I looked also at gbarcode but i can`t find that  
> option.

Usually you shouldn’t have to set the PPI of an image - see  
[http://www.rideau-info.com/photos/mythdpi.html](http://www.rideau-info.com/photos/mythdpi.html)

But you can set it by using the RmagickOutputter and generating a  
Magick::Image instance with to\_image:

barcode = Barby::Code128B.new(‘hello’)  
image = barcode.to\_image  
image.density = “300x300”  
image.write(‘hello.png’)

See [http://www.imagemagick.org/RMagick/doc/](http://www.imagemagick.org/RMagick/doc/)
