class P3libImage
library for all helper image classes
Public Class Methods
convertImgToFiletype(inImage,outImage,type)
click to toggle source
TODO TEST
# File lib/refx/engine/p3lib/p3lib_image.rb, line 46 def self.convertImgToFiletype(inImage,outImage,type) cmd = "#{self.p3imgutils_path}/p3convfiletype -i '#{inImage}' -o '#{outImage}' -t #{type}" P3libLogger::log("convertingh #{inImage} to #{outImage} of type #{type}") system(cmd) end
p3imgutils_path()
click to toggle source
# File lib/refx/engine/p3lib/p3lib_image.rb, line 9 def self.p3imgutils_path p3imgutils_path = File.expand_path('../../p3imgutils', __FILE__) # p p3imgutils_path return p3imgutils_path end
resizeBitmap(img,pixWidth,pixHeight)
click to toggle source
# File lib/refx/engine/p3lib/p3lib_image.rb, line 19 def self.resizeBitmap(img,pixWidth,pixHeight) cmd = "#{self.p3imgutils_path}/p3scale -w#{pixWidth} -h#{pixHeight} -i '#{img}' -o '#{img}'" P3libLogger::log("resizing cmd:",cmd) system(cmd) end
resizeBitmapByWidth(img,pixWidth)
click to toggle source
# File lib/refx/engine/p3lib/p3lib_image.rb, line 31 def self.resizeBitmapByWidth(img,pixWidth) cmd = "#{self.p3imgutils_path}/p3scale -w#{pixWidth} -h0 -i '#{img}' -o '#{img}'" P3libLogger::log("resizing cmd:",cmd) system(cmd) end
resizeBitmapWithOutputType(imgIN,imgOUT,pixWidth,pixHeight,type)
click to toggle source
# File lib/refx/engine/p3lib/p3lib_image.rb, line 25 def self.resizeBitmapWithOutputType(imgIN,imgOUT,pixWidth,pixHeight,type) cmd = "#{self.p3imgutils_path}/p3scale -w#{pixWidth} -h#{pixHeight} -i '#{imgIN}' -o '#{imgOUT}' -t #{type}" P3libLogger::log("resizing with type cmd:",cmd) system(cmd) end
trimAlphaFromImage(inImage,outImage)
click to toggle source
# File lib/refx/engine/p3lib/p3lib_image.rb, line 37 def self.trimAlphaFromImage(inImage,outImage) cmd = "#{self.p3imgutils_path}/p3trimalpha -i '#{inImage}' -o '#{outImage}'" P3libLogger::log("trimming alpha to :",outImage) P3libLogger::log("trimming alpha using :",cmd) system(cmd) end
Public Instance Methods
getXYRatio(original_size,newWidth, newHeight)
click to toggle source
# File lib/refx/engine/p3lib/p3lib_image.rb, line 15 def getXYRatio(original_size,newWidth, newHeight) return newWidth.to_f / original_size.width.to_f, newHeight.to_f / original_size.height.to_f end