Module: Asposeimagingjava::DitheringImage

Defined in:
lib/asposeimagingjava/images/ditheringimage.rb

Instance Method Summary collapse

Instance Method Details

#initializeObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/asposeimagingjava/images/ditheringimage.rb', line 3

def initialize()
    data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'

    # Load an existing image

    image = Rjb::import('com.aspose.imaging.Image').load(data_dir + "test.jpg")

    # Perform Floyd Steinberg dithering on the current image

    image.dither(Rjb::import('com.aspose.imaging.DitheringMethod').ThresholdDithering, 4)

    # Save the image to disk

    image.save(data_dir + "DitheringImage.jpg")

    # Display Status.

    puts "Dithering image successfully!"
end