ruby - Converting images with MacRuby -


does know how convert images macruby (or normal ruby)? imagine 'scriptingbridge' framework able handle it.

in addition, prefer not use imagemagick or (something lighter fine, however).

thanks!

you can macruby:

 framework 'appkit'   input_file_path = "/users/username/desktop/input_file.png"  img_data = nsdata.datawithcontentsoffile(input_file_path)  bitmap = nsbitmapimagerep.imagerepwithdata(img_data)   new_data = bitmap.representationusingtype(nsjpegfiletype, properties: nil)  # nsbmpfiletype, nsgiffiletype, nsjpegfiletype, nspngfiletype, or nstifffiletype.   output_file_path = "/users/username/desktop/output_file.jpeg"  new_data.writetofile(output_file_path, atomically: true) 

and you're done, nsbitmapimagerep#representationusingtype:properties: can takes nsbmpfiletype, nsgiffiletype, nsjpegfiletype, nspngfiletype or nstifffiletype bmp, gif, jpeg, png or tiff


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -