Ruby wrapper for libjpeg to resize image - ruby

is there a ruby wrapper for the libjpeg library (http://www.ijg.org/)? What I'm trying to do is create an extension to the Rhomobile Framework so that I can resize images on my mobile app.
Thanks,
Nick,

The easiest solution might be to offload this work to an external service if possible.
I did find this though: jpegtran ruby gem jpegtran can be used to resize via libjpeg, if available on the platform.

not sure if it will suit your needs for mobile, but give rmagick a spin

Related

Ruby Equivalent of the GD Library usage in PHP

I am looking to write an app that overlays images and copy on top of another image. I know in PHP you can use the GD library but for Ruby does anyone have a specific suggestion of a gem that would help with this?
I have seen 2 gems already but not sure which is the one most people use.
https://github.com/Spakman/ruby-gd
http://rubygems.org/gems/gd2
gd is a bit dated as a library for image manipulation/processing. The gems you listed are old, quite old in fact and likely will have issues with newer versions of Ruby.
Based on my own experience, I would look into a gem like minimagick which provides a nice interface to ImageMagick which is a more common library for the tasks you're trying to do.
The modern version of gem for working with GD library is https://github.com/dark-panda/gd2-ffij ... obviously, ImageMagick bindings are more powerful, but ImageMagick library have much more dependences and is generally heavyweight.

Is there some easy use image processing/editing library for Cocoa?

Like OpenCV
I hope the library can do several simple image edit operation, like DrawLine(UiImage, startPoint, endPoint), or ConvertToGray(UiImage)
CoreImage is the built-in image manipulation library in Cocoa.
For example: What is the best Core Image filter to produce black and white effects?
I'd suggest using OpenCV , which is a great algorithms and image processing library.
Choosing Opencv would give you more future option.
Try this
OpenCV is not meant for image editing. You can do that, but it's like buying a big track to carry your groceries from the market.
The best way to do it is to look into some already integrated image editing libraries. And as I know, in Cocoa there are several of them. CoreImage, mentioned by Dor, is one of them.
And there are some specialized image editing / UI toolkits that may help you better than OpenCV. You may check whether ImageMagik or QT are available for Mac/iOS

Alternatives for HornetsEye - Ruby

I installed HornetsEye, that "real-time computer vision library" for some experiments with my webcam. I want to know if are there other alternatives in ruby?
RMagick comes to mind, but it is not very very performant ...
I have not tested it yet personally, but since OpenCV is definitely the way to go from C++, the ruby-opencv gem could be interesting. I could only find this one actively developped, though.
http://github.com/ruby-opencv/ruby-opencv
Perhaps Camellia Image Processing Library interests you because.
It has been written in C but has a native wrapper for RUBY and its performance is very good.

Annotate images using tools built into OS X

I want to overlay text on images on OS X, preferably without installing additional software, so that, as a sysadmin, I can know at a glance that machines are up-to-date, in a way that is easily scriptable and easily modifiable, and can run without GUI access. [Being able to overlay images or apply color-changing effects would be a bonus.]
Mac OS X Leopard comes with a ton of stuff built-in: Perl, Python, Ruby, Tcl/Tk, Bash; wxWidgets, some Quartz integration, and even Objective-C integration for Python and Ruby. There must be several good ways to do this, if I were only versed in these systems.
I'm continuing to go through the examples in the /Developer folder on my computer, and I have got a partial idea of how this might be done in Cocoa and converted to PyObjC. I decided I would have to deploy ImageMagick, but in my testing, I am running into an infamous bus error, and would prefer not to have to compile ImageMagick or GraphicsMagick with all its dependancies if I can do what I need to out-of-the-box. [That said, I would consider installing additional components, but it would be a big win to have something that would work on a stock install of OS X].
This seems like it'd be relatively simple to do using Python and the Python Imaging Library (PIL). I don't think PIL is installed with OS X by default, but it's relatively easy to install manually and doesn't have a ton of dependencies. The PIL tutorials are also pretty good -- it shouldn't be too hard to whip up a command-line or GUI program to do what you want.
CocoaMagic is a single-file replacement for large parts of RMagick (Ruby integration with ImageMagick or GraphicsMagick). It should be useable as a library in its own right, or by appending things to the bottom of the script.

C++ Cross Platform Image Loader for OpenGL

I have tried everything from SDL to DevIL, and they have all failed for various reasons.
SDL segfaults for various reasons, and DevIL is having some weird problem where even after i include IL/ilut.h and linking everything, and including the other headers, it is not defining the functions i need to load images into opengl textures (something about USE_OPEN_GL not being defined). I am asking for any other lib out there for loading bitmaps or png's into a format i can easily convert to opengl, or a solution to the devil problem.
thanks
Both libpng and libjpeg can be rather daunting to build & use -- no wonder there are all sorts of wrapper libraries for both.
A very simple and minimal no-nonsense loader for jpg/png (and some other stuff aswell) without dependencies in a single C file is Sean Barrett's stb_image.c, if you just want to load some image files it adds absolutely minimal overhead to your program and is straightforward to use:
http://nothings.org/stb_image.c
As Adam suggests, I would also recommend to use libpng and libjpeg. You are not specifying if you write in C or C++, but if in C++, then I'd suggest to take a look at two handy thin wrappers on the both libraries: pngxx and jpegxx
LodePNG is a highly compact PNG Loader with no dependencies.
Comment on your experience with DevIL - it works flawlessly for me and many others. Why not try again to resolve your build problems? - shouldn't be too hard)
You can also try FreeImage library. It supports loading different image types and is functionally similar to DevIL, may work out of the box for you.
And about your problem with DevIL, you do not have to build ilu or ilut libraries to make DevIL functional. I would recommend you manage the OpenGL texture objects yourself, including uploading image data to OpenGL side.
SOIL is a decent lightweight one I've used before. It's actually specialized for loading OpenGL textures too.
http://lonesock.net/soil.html
you dont need ILUT to do what you want. you can simply use ilGetData() and glTexImage2d()
Loading bitmaps (.bmp) and netpbm images (.pbm, pgm, .pnm) is fairly trivial, since they store images uncompressed. For loading PNGs, use libpng. For loading JPEGs, use libjpeg. For other image types, use an appropriate library. There's a good change that slapping on 'lib' to the beginning of the image name will give you such a library, e.g. libtiff, libtga, etc.
Once you've loaded and uncompressed the raw image data, loading it into an OpenGL texture is just a matter of calling glTexImage2D() with the right parameters, and a couple of other GL state changes (e.g. how to do mipmapping).
Image Magick with either the C or C++ bindings?
http://www.imagemagick.org/script/index.php
Young but yet great enough SFML could be the one you're searching for. I've used it for numerous projects and all of 'em worked well on all my platforms (Win7 and Ubuntu).

Resources