asposeimagingjava 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +3 -0
  3. data/LICENSE +21 -0
  4. data/README.md +33 -0
  5. data/Rakefile +2 -0
  6. data/asposeimagingjava.gemspec +27 -0
  7. data/config/aspose.yml +5 -0
  8. data/data/aspose.bmp +0 -0
  9. data/data/bizcard.psd +0 -0
  10. data/data/demo.djvu +0 -0
  11. data/data/demo.tif +0 -0
  12. data/data/multipage.tiff +0 -0
  13. data/data/sample.djvu +0 -0
  14. data/data/sample.emf +0 -0
  15. data/data/sample.gif +0 -0
  16. data/data/sample.jpg +0 -0
  17. data/data/sample.png +0 -0
  18. data/data/sample.tiff +0 -0
  19. data/data/samples/sample.jpg +0 -0
  20. data/data/samples/test.jpg +0 -0
  21. data/data/test.jpg +0 -0
  22. data/data/test.tiff +0 -0
  23. data/lib/asposeimagingjava.rb +71 -0
  24. data/lib/asposeimagingjava/asposeimaging.rb +5 -0
  25. data/lib/asposeimagingjava/djvu.rb +5 -0
  26. data/lib/asposeimagingjava/djvu/convertingdjvutopdf.rb +29 -0
  27. data/lib/asposeimagingjava/djvu/convertingdjvutotiff.rb +23 -0
  28. data/lib/asposeimagingjava/djvu/convertingrangeofdjvupages.rb +26 -0
  29. data/lib/asposeimagingjava/djvu/convertingrangeofdjvupagestoseparateimages.rb +30 -0
  30. data/lib/asposeimagingjava/djvu/convertingspecificportionofdjvupage.rb +32 -0
  31. data/lib/asposeimagingjava/drawing.rb +6 -0
  32. data/lib/asposeimagingjava/drawing/drawingarc.rb +37 -0
  33. data/lib/asposeimagingjava/drawing/drawingellipse.rb +43 -0
  34. data/lib/asposeimagingjava/drawing/drawingimagesusingcorefunctionality.rb +33 -0
  35. data/lib/asposeimagingjava/drawing/drawingimagesusinggraphics.rb +34 -0
  36. data/lib/asposeimagingjava/drawing/drawinglines.rb +53 -0
  37. data/lib/asposeimagingjava/drawing/drawingrectangle.rb +44 -0
  38. data/lib/asposeimagingjava/images.rb +20 -0
  39. data/lib/asposeimagingjava/images/addimagesasseparateframesintiff.rb +57 -0
  40. data/lib/asposeimagingjava/images/addthumbnailtoexifsegment.rb +25 -0
  41. data/lib/asposeimagingjava/images/addthumbnailtojfifsegment.rb +25 -0
  42. data/lib/asposeimagingjava/images/addwatermarktoimage.rb +30 -0
  43. data/lib/asposeimagingjava/images/adjustingcolors.rb +80 -0
  44. data/lib/asposeimagingjava/images/autocorrectorientationofjpegimage.rb +19 -0
  45. data/lib/asposeimagingjava/images/compresspngimage.rb +22 -0
  46. data/lib/asposeimagingjava/images/concatenatemultipletiffimages.rb +24 -0
  47. data/lib/asposeimagingjava/images/convertingrasterimages.rb +80 -0
  48. data/lib/asposeimagingjava/images/createjpegthumbnail.rb +21 -0
  49. data/lib/asposeimagingjava/images/cropimages.rb +63 -0
  50. data/lib/asposeimagingjava/images/datarecoverytiffimages.rb +21 -0
  51. data/lib/asposeimagingjava/images/ditheringimage.rb +19 -0
  52. data/lib/asposeimagingjava/images/exportimagetodifferentformats.rb +24 -0
  53. data/lib/asposeimagingjava/images/extracttiffframestootherformat.rb +19 -0
  54. data/lib/asposeimagingjava/images/readandmodifyjpegexiftags.rb +91 -0
  55. data/lib/asposeimagingjava/images/resizeimage.rb +63 -0
  56. data/lib/asposeimagingjava/images/rotateandflipimage.rb +18 -0
  57. data/lib/asposeimagingjava/images/specifybitdepthforpngimage.rb +25 -0
  58. data/lib/asposeimagingjava/images/specifytransparencyforpngimage.rb +32 -0
  59. data/lib/asposeimagingjava/metafiles.rb +2 -0
  60. data/lib/asposeimagingjava/metafiles/convertmetafiletootherformats.rb +28 -0
  61. data/lib/asposeimagingjava/metafiles/cropmetafile.rb +22 -0
  62. data/lib/asposeimagingjava/photoshop/createpsd.rb +42 -0
  63. data/lib/asposeimagingjava/photoshop/exportimagetopsd.rb +26 -0
  64. data/lib/asposeimagingjava/psd.rb +2 -0
  65. data/lib/asposeimagingjava/version.rb +3 -0
  66. data/samples/djvu.rb +13 -0
  67. data/samples/drawing.rb +14 -0
  68. data/samples/images.rb +29 -0
  69. data/samples/metafiles.rb +10 -0
  70. data/samples/psd.rb +10 -0
  71. metadata +170 -0
@@ -0,0 +1,33 @@
1
+ module Asposeimagingjava
2
+ module DrawingImagesUsingCoreFunctionality
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create an instance of BmpOptions and set its various properties
7
+ create_options = Rjb::import('com.aspose.imaging.imageoptions.BmpOptions').new
8
+ create_options.setBitsPerPixel(24)
9
+
10
+ # Create an instance of FileCreateSource and assign it to Source property
11
+ create_options.setSource(Rjb::import('com.aspose.imaging.sources.FileCreateSource').new(data_dir + "DrawingImage.bmp",false))
12
+
13
+ # Create an instance of RasterImage
14
+ raster_image = Rjb::import('com.aspose.imaging.Image').create(create_options,500,500)
15
+
16
+ # Get the pixels of the image by specifying the area as image boundary
17
+ pixels = raster_image.loadPixels(raster_image.getBounds())
18
+
19
+ index = 0
20
+ while index < pixels.length
21
+ # Set the indexed pixel color to yellow
22
+ pixels[index] = Rjb::import('com.aspose.imaging.Color').getYellow()
23
+ index +=1
24
+ end
25
+ raster_image.savePixels(raster_image.getBounds(), pixels)
26
+
27
+ # save all changes
28
+ raster_image.save()
29
+
30
+ puts "Draw Images Using Core Functionality."
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,34 @@
1
+ module Asposeimagingjava
2
+ module DrawingImagesUsingGraphics
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create an instance of BmpOptions and set its various properties
7
+ create_options = Rjb::import('com.aspose.imaging.imageoptions.BmpOptions').new
8
+ create_options.setBitsPerPixel(24)
9
+
10
+ # Create an instance of FileCreateSource and assign it to Source property
11
+ create_options.setSource(Rjb::import('com.aspose.imaging.sources.FileCreateSource').new(data_dir + "DrawingImageUsingGraphics.bmp",false))
12
+
13
+ # Create an instance of Image
14
+ image = Rjb::import('com.aspose.imaging.Image').create(create_options,500,500)
15
+
16
+ # Create and initialize an instance of Graphics
17
+ graphics = Rjb::import('com.aspose.imaging.Graphics').new(image)
18
+
19
+ # Clear the image surface with white color
20
+ graphics.clear(Rjb::import('com.aspose.imaging.Color').getWhite())
21
+
22
+ # Create and initialize a Pen object with blue color
23
+ pen = Rjb::import('com.aspose.imaging.Pen').new(Rjb::import('com.aspose.imaging.Color').getBlue())
24
+
25
+ # Draw Ellipse by defining the bounding rectangle of width 150 and height 100
26
+ graphics.drawEllipse(pen, Rjb::import('com.aspose.imaging.Rectangle').new(10, 10, 150, 100))
27
+
28
+ # save all changes
29
+ image.save()
30
+
31
+ puts "Created image using graphics."
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,53 @@
1
+ module Asposeimagingjava
2
+ module DrawingLines
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create an instance of BmpOptions and set its various properties
7
+ create_options = Rjb::import('com.aspose.imaging.imageoptions.BmpOptions').new
8
+ create_options.setBitsPerPixel(32)
9
+
10
+ # Define the source property for the instance of BmpOptions
11
+ create_options.setSource(Rjb::import('com.aspose.imaging.sources.StreamSource').new(Rjb::import('java.io.ByteArrayInputStream').new(Array.new)))
12
+
13
+ # Create an instance of Image
14
+ image = Rjb::import('com.aspose.imaging.Image').create(create_options,100,100)
15
+
16
+ # Create an instance of Color
17
+ color = Rjb::import('com.aspose.imaging.Color')
18
+
19
+ # Create an instance of Pen
20
+ pen = Rjb::import('com.aspose.imaging.Pen')
21
+
22
+ # Create and initialize an instance of Graphics class
23
+ graphic = Rjb::import('com.aspose.imaging.Graphics').new(image)
24
+
25
+ # Clear the image surface with Yellow color
26
+ graphic.clear(color.getYellow())
27
+
28
+ # Draw a dotted line by specifying the Pen object having blue color and co-ordinate Points
29
+ graphic.drawLine(pen.new(color.getBlue()), 9, 9, 90, 90)
30
+ graphic.drawLine(pen.new(color.getBlue()), 9, 90, 90, 9)
31
+
32
+ solid_brush = Rjb::import('com.aspose.imaging.brushes.SolidBrush')
33
+ point = Rjb::import('com.aspose.imaging.Point')
34
+
35
+ # Draw a continuous line by specifying the Pen object having Solid Brush with red color and two point structures
36
+ graphic.drawLine(pen.new(solid_brush.new(color.getRed())), point.new(9, 9), point.new(9, 90))
37
+
38
+ # Draw a continuous line by specifying the Pen object having Solid Brush with aqua color and two point structures
39
+ graphic.drawLine(pen.new(solid_brush.new(color.getAqua())), point.new(9, 90), point.new(90, 90))
40
+
41
+ # Draw a continuous line by specifying the Pen object having Solid Brush with black color and two point structures
42
+ graphic.drawLine(pen.new(solid_brush.new(color.getBlack())), point.new(90,90), point.new(90,9))
43
+
44
+ # Draw a continuous line by specifying the Pen object having Solid Brush with white color and two point structures
45
+ graphic.drawLine(pen.new(solid_brush.new(color.getWhite())), point.new(90,9), point.new(9,9))
46
+
47
+ # Save all changes.
48
+ image.save(data_dir + "DrawLinesExample.bmp")
49
+
50
+ puts "Lines have been drawn in image successfully!"
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,44 @@
1
+ module Asposeimagingjava
2
+ module DrawingRectangle
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create an instance of BmpOptions and set its various properties
7
+ create_options = Rjb::import('com.aspose.imaging.imageoptions.BmpOptions').new
8
+ create_options.setBitsPerPixel(32)
9
+
10
+ # Define the source property for the instance of BmpOptions
11
+ create_options.setSource(Rjb::import('com.aspose.imaging.sources.StreamSource').new(Rjb::import('java.io.ByteArrayInputStream').new(Array.new)))
12
+
13
+ # Create an instance of Image
14
+ image = Rjb::import('com.aspose.imaging.Image').create(create_options,100,100)
15
+
16
+ # Create an instance of Color
17
+ color = Rjb::import('com.aspose.imaging.Color')
18
+
19
+ # Create an instance of Pen
20
+ pen = Rjb::import('com.aspose.imaging.Pen')
21
+
22
+ # Create and initialize an instance of Graphics class
23
+ graphic = Rjb::import('com.aspose.imaging.Graphics').new(image)
24
+
25
+ # Clear the image surface with Yellow color
26
+ graphic.clear(color.getYellow())
27
+
28
+ solid_brush = Rjb::import('com.aspose.imaging.brushes.SolidBrush')
29
+ rectangle = Rjb::import('com.aspose.imaging.Rectangle')
30
+
31
+ # Draw a dotted rectangle shape by specifying the Pen object having red color and a rectangle structure
32
+ graphic.drawRectangle(pen.new(color.getRed()), rectangle.new(30, 10, 40, 80))
33
+
34
+ # Draw a continuous rectangle shape by specifying the Pen object having
35
+ # solid brush with blue color and a rectangle structure
36
+ graphic.drawRectangle(pen.new(solid_brush.new(color.getBlue())), rectangle.new(10, 30, 80, 40))
37
+
38
+ # Save all changes.
39
+ image.save(data_dir + "DrawRectanleExample.bmp")
40
+
41
+ puts "Rectangle have been drawn in image successfully!"
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,20 @@
1
+ require_relative 'images/exportimagetodifferentformats'
2
+ require_relative 'images/addwatermarktoimage'
3
+ require_relative 'images/rotateandflipimage'
4
+ require_relative 'images/cropimages'
5
+ require_relative 'images/resizeimage'
6
+ require_relative 'images/ditheringimage'
7
+ require_relative 'images/convertingrasterimages'
8
+ require_relative 'images/adjustingcolors'
9
+ require_relative 'images/specifytransparencyforpngimage'
10
+ require_relative 'images/compresspngimage'
11
+ require_relative 'images/specifybitdepthforpngimage'
12
+ require_relative 'images/createjpegthumbnail'
13
+ require_relative 'images/autocorrectorientationofjpegimage'
14
+ require_relative 'images/addthumbnailtojfifsegment'
15
+ require_relative 'images/addthumbnailtoexifsegment'
16
+ require_relative 'images/readandmodifyjpegexiftags'
17
+ require_relative 'images/extracttiffframestootherformat'
18
+ require_relative 'images/concatenatemultipletiffimages'
19
+ require_relative 'images/datarecoverytiffimages'
20
+ require_relative 'images/addimagesasseparateframesintiff'
@@ -0,0 +1,57 @@
1
+ module Asposeimagingjava
2
+ module AddImagesAsSeparateFramesInTiff
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create an instance of TiffOptions with CCITTFAX3 compression
7
+ tiff_expected_format = Rjb::import('com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat')
8
+ output_settings = Rjb::import('com.aspose.imaging.imageoptions.TiffOptions').new(tiff_expected_format.TiffCcittFax3)
9
+
10
+ # Set source for the result
11
+ output_settings.setSource(Rjb::import('com.aspose.imaging.sources.FileCreateSource').new(data_dir + "output.tiff", false))
12
+
13
+ # Declare Height and Width for the new TiffImage
14
+ new_width = 500
15
+ new_height = 500
16
+
17
+ # Create an instance of TiffImage using the object of TiffOptions and dimension
18
+ tiff_image = Rjb::import('com.aspose.imaging.Image').create(output_settings, new_width, new_height)
19
+
20
+ # Initialize a variable to keep track of frames in the TiffImage
21
+ index = 0
22
+
23
+ # Read all JPG files from any specified directory and iterate over the list
24
+ folder = Rjb::import('java.io.File').new(data_dir + "samples/")
25
+
26
+ files = folder.listFiles()
27
+ files.each do |fileEntry|
28
+ # Load the image into an instance of RasterImage
29
+ image = Rjb::import('com.aspose.imaging.Image').load(fileEntry.getAbsolutePath())
30
+
31
+ # Resize the image according to TiffImage dimensions
32
+ image.resize(new_width, new_height, Rjb::import('com.aspose.imaging.ResizeType').NearestNeighbourResample)
33
+
34
+ # Get the active frame of TiffImage
35
+ frame = tiff_image.getActiveFrame()
36
+
37
+ # Save the RasterImage data onto TiffFrame
38
+ frame.savePixels(frame.getBounds(), image.loadPixels(image.getBounds()))
39
+
40
+ # Check if TiffImage already has a frame
41
+ if index > 0
42
+ # Create a new TiffFrame according to the TiffOptions settings
43
+ frame = Rjb::import('com.aspose.imaging.fileformats.tiff.TiffFrame').new(Rjb::import('com.aspose.imaging.imageoptions.TiffOptions').new(output_settings), new_width, new_height)
44
+
45
+ # Add the newly created frame to the TiffImage
46
+ tiff_image.addFrame(frame)
47
+ end
48
+ index +=1
49
+ end
50
+
51
+ # Save the changes to TiffImage
52
+ tiff_image.save()
53
+
54
+ puts "Added Different Images as Separate Frames in a Multi-Page TIFF"
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,25 @@
1
+ module Asposeimagingjava
2
+ module AddThumbnailToEXIFSegment
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create an instance of JpegImage to store the thumbnail
7
+ thumbnail = Rjb::import('com.aspose.imaging.fileformats.jpeg.JpegImage').new(100, 100)
8
+
9
+ # Create another instance of JpegImage as primary image
10
+ image = Rjb::import('com.aspose.imaging.fileformats.jpeg.JpegImage').new(1000, 1000)
11
+
12
+ # Set the ExifData value as new JpegExifData
13
+ image.setExifData(Rjb::import('com.aspose.imaging.exif.JpegExifData').new)
14
+
15
+ # Store the thumbnail in the Exif segment
16
+ image.getExifData().set_Thumbnail(thumbnail)
17
+
18
+ # Save the resultant image
19
+ image.save(data_dir + "Thumbnail_EXIF.jpg")
20
+
21
+ # Display Status.
22
+ puts "Added thumbnail to EXIF segment successfully!"
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ module Asposeimagingjava
2
+ module AddThumbnailToJFIFSegment
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create an instance of JpegImage to store the thumbnail
7
+ thumbnail = Rjb::import('com.aspose.imaging.fileformats.jpeg.JpegImage').new(100, 100)
8
+
9
+ # Create another instance of JpegImage as primary image
10
+ image = Rjb::import('com.aspose.imaging.fileformats.jpeg.JpegImage').new(1000, 1000)
11
+
12
+ # Set the Jfif value as new JFIFData
13
+ image.setJfif(Rjb::import('com.aspose.imaging.fileformats.jpeg.JFIFData').new)
14
+
15
+ # Store the thumbnail in the Jfif segment
16
+ image.getJfif().setThumbnail(thumbnail)
17
+
18
+ # Save the resultant image
19
+ image.save(data_dir + "Thumbnail_JFIF.jpg")
20
+
21
+ # Display Status.
22
+ puts "Added thumbnail to JFIF segment successfully!"
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,30 @@
1
+ module Asposeimagingjava
2
+ module AddWatermarkToImage
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Load an existing image (of type bmp) in an instance of Image class
7
+ image = Rjb::import('com.aspose.imaging.Image').load(data_dir + "aspose.bmp")
8
+
9
+ # Create and initialize an instance of Graphics
10
+ graphics = Rjb::import('com.aspose.imaging.Graphics').new(image)
11
+
12
+ # Creates an instance of Font
13
+ font = Rjb::import('com.aspose.imaging.Font').new("Times New Roman", 16, Rjb::import('com.aspose.imaging.FontStyle').Bold)
14
+
15
+ # Create an instance of SolidBrush and set its various properties.
16
+ brush = Rjb::import('com.aspose.imaging.brushes.SolidBrush').new
17
+ brush.setColor(Rjb::import('com.aspose.imaging.Color').getBlack())
18
+ brush.setOpacity(100)
19
+
20
+ # Draw a String using the SolidBrush object and Font, at specific Point.
21
+ graphics.drawString("Aspose.Imaging for Ruby", font, brush, Rjb::import('com.aspose.imaging.PointF').new(image.getWidth()-100, image.getHeight()-100))
22
+
23
+ # save the image with changes
24
+ image.save(data_dir + "out.bmp")
25
+
26
+ # Display Status.
27
+ puts "Watermark added successfully!"
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,80 @@
1
+ module Asposeimagingjava
2
+ module AdjustingColors
3
+ def initialize()
4
+ # Adjusting Brightness
5
+ adjust_brightness()
6
+
7
+ # Adjusting Contrast
8
+ adjust_contrast()
9
+
10
+ # Adjusting Contrast
11
+ adjust_gamma()
12
+ end
13
+
14
+ def adjust_brightness()
15
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
16
+
17
+ # Load an existing image
18
+ image = Rjb::import('com.aspose.imaging.Image').load(data_dir + "test.jpg")
19
+
20
+ # Check if image is cached
21
+ if !image.isCached()
22
+ # Cache image if not already cached
23
+ image.cacheData()
24
+ end
25
+
26
+ # Adjust the brightness
27
+ image.adjustBrightness(70)
28
+
29
+ # Save the image to disk
30
+ image.save(data_dir + "adjust_brightness.jpg")
31
+
32
+ # Display Status.
33
+ puts "Adjust image brightness successfully!"
34
+ end
35
+
36
+ def adjust_contrast()
37
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
38
+
39
+ # Load an existing image
40
+ image = Rjb::import('com.aspose.imaging.Image').load(data_dir + "test.jpg")
41
+
42
+ # Check if image is cached
43
+ if !image.isCached()
44
+ # Cache image if not already cached
45
+ image.cacheData()
46
+ end
47
+
48
+ # Adjust the contrast
49
+ image.adjustContrast(10)
50
+
51
+ # Save the image to disk
52
+ image.save(data_dir + "adjust_contrast.jpg")
53
+
54
+ # Display Status.
55
+ puts "Adjust image contrast successfully!"
56
+ end
57
+
58
+ def adjust_gamma()
59
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
60
+
61
+ # Load an existing image
62
+ image = Rjb::import('com.aspose.imaging.Image').load(data_dir + "test.jpg")
63
+
64
+ # Check if image is cached
65
+ if !image.isCached()
66
+ # Cache image if not already cached
67
+ image.cacheData()
68
+ end
69
+
70
+ # Adjust the gamma
71
+ image.adjustGamma(2.2, 2.2, 2.2)
72
+
73
+ # Save the image to disk
74
+ image.save(data_dir + "adjust_gamma.jpg")
75
+
76
+ # Display Status.
77
+ puts "Adjust image gamma successfully!"
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,19 @@
1
+ module Asposeimagingjava
2
+ module AutoCorrectOrientationOfJpegImage
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Load an existing image in an instance of Image class
7
+ image = Rjb::import('com.aspose.imaging.Image').load(data_dir + "test.jpg")
8
+
9
+ # Perform the automatic rotation on the image depending on the orientation data stored in the EXIF
10
+ image.autoRotate()
11
+
12
+ # Save the image
13
+ image.save(data_dir + "AutoCorrectOrientation.jpg")
14
+
15
+ # Display Status.
16
+ puts "Auto Correct orientation of JPEG image successfully!"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,22 @@
1
+ module Asposeimagingjava
2
+ module CompressPngImage
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Load an existing image (of type bmp) in an instance of Image class
7
+ image = Rjb::import('com.aspose.imaging.Image').load(data_dir + "sample.png")
8
+
9
+ # Create an instance of PngOptions
10
+ options = Rjb::import('com.aspose.imaging.imageoptions.PngOptions').new
11
+
12
+ # Set CompressionLevel
13
+ options.setCompressionLevel(1)
14
+
15
+ # Save the result on disc
16
+ image.save(data_dir + "compress.png", options)
17
+
18
+ # Display Status.
19
+ puts "Compressed PNG image successfully!"
20
+ end
21
+ end
22
+ end