Module: Asposeimagingjava::CreateJpegThumbnail

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

Instance Method Summary collapse

Instance Method Details

#initializeObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/asposeimagingjava/images/createjpegthumbnail.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 + "test.jpg")

    if image.getExifData() != nil
        # Get the image thumbnail information and save it in an instance of JpegImage

        thumbnail = image.getExifData().get_Thumbnail()

        # Save the thumbnail to disk with a new name

        thumbnail.save(data_dir + "JpegThumbnail.jpeg")

        # Display Status.

        puts "Created thumbnail of JPEG image successfully!"
    end
end