Module: Asposeimagingjava::AdjustingColors
- Defined in:
- lib/asposeimagingjava/images/adjustingcolors.rb
Instance Method Summary collapse
Instance Method Details
#adjust_brightness ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/asposeimagingjava/images/adjustingcolors.rb', line 14 def adjust_brightness() 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") # Check if image is cached if !image.isCached() # Cache image if not already cached image.cacheData() end # Adjust the brightness image.adjustBrightness(70) # Save the image to disk image.save(data_dir + "adjust_brightness.jpg") # Display Status. puts "Adjust image brightness successfully!" end |
#adjust_contrast ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/asposeimagingjava/images/adjustingcolors.rb', line 36 def adjust_contrast() 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") # Check if image is cached if !image.isCached() # Cache image if not already cached image.cacheData() end # Adjust the contrast image.adjustContrast(10) # Save the image to disk image.save(data_dir + "adjust_contrast.jpg") # Display Status. puts "Adjust image contrast successfully!" end |
#adjust_gamma ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/asposeimagingjava/images/adjustingcolors.rb', line 58 def adjust_gamma() 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") # Check if image is cached if !image.isCached() # Cache image if not already cached image.cacheData() end # Adjust the gamma image.adjustGamma(2.2, 2.2, 2.2) # Save the image to disk image.save(data_dir + "adjust_gamma.jpg") # Display Status. puts "Adjust image gamma successfully!" end |
#initialize ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/asposeimagingjava/images/adjustingcolors.rb', line 3 def initialize() # Adjusting Brightness adjust_brightness() # Adjusting Contrast adjust_contrast() # Adjusting Contrast adjust_gamma() end |