Module: Asposeimagingjava::CompressPngImage
- Defined in:
- lib/asposeimagingjava/images/compresspngimage.rb
Instance Method Summary collapse
Instance Method Details
#initialize ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/asposeimagingjava/images/compresspngimage.rb', line 3 def initialize() data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/' # Load an existing image (of type bmp) in an instance of Image class image = Rjb::import('com.aspose.imaging.Image').load(data_dir + "sample.png") # Create an instance of PngOptions = Rjb::import('com.aspose.imaging.imageoptions.PngOptions').new # Set CompressionLevel .setCompressionLevel(1) # Save the result on disc image.save(data_dir + "compress.png", ) # Display Status. puts "Compressed PNG image successfully!" end |