What is the difference between ImageMagick and libGD? - gd

I don't know anything about either library but I have to choose one of them.
Which one whould you recommend?
I'm using Perl. I need to generate images for weather site. The image is generated for a location and should contain temperature and a weather condition image inside. I guess this is a piece of cake for both libs. But I want to know which one is more powerful. I've read that libGD is not able to rotate text. Maybe there are some other drawbacks? Which one generates images faster? Whose API is easier to use?

according to this source, you should use GD:
GD and other modules built on top of that (like GD::Graph) are more aimed at producing "new" images like charts.
And you can read "Develop your own weather maps and alerts with Perl and GD", which is what you're looking for.
If you some some time. try them both, play a little, and decide.

I find both to be straightforward to use ImageMagick gives you a lot more power than gd. Here are two Magick examples from my posts:
How can I use IO::Scalar with Image::Magick::Read()
How can I resize an image to fit area with Image::Magick?
to give you examples of the API.
I have used GD to create a visualization.
See Script : giss-timeline-graphs.pl on that page.

imagemagick is more robust, however libGD should be able to cover most of the image generation tasks as well. you should see perl API/functions to both of these libraries to see what is more convenient for you.

Related

Compare image in dalekjs

I wanted to automate image comparison through dalekjs. Aim is to have better image comparisons through external libraries but for starters a basic image comparison will do to tell if image on page is equal to local image. Help is highly appreciated.
Still experimental and is yet to be merged into DalekJS core, but you could try using gskachkov's pull request here which adds screenshot comparison functionality to DalekJS.
Otherwise, I would recommend you to use PhantomCSS as your visual regression framework for the time being. PhantomCSS is built on top of CasperJS and uses Resemble.js for image comparison.
Dalek isn't designed to be used as an image comparison tool, but some people used it as a foundation to write their own tools, like siteeffect.io
If you need to want to compare two images you need to make a screenshot with Dalek, need to know the coordinates of the image & then run some image comparison using Image Magick or whatever.
If you have some code/experiment up on GitHub or so, I´m happy to provide guidance to get the data out of Dalek & to use it programmatically.

find similar image in library to photo

I work at a printer where we generate thumbnails of artwork for orders and store them in a folder before printing.
I'm looking for a code library that will allow us to take a photo of a printed item and look through the library of thumbnails for the design.
Just wondered if anyone knows of a library or api that could do this?
Thanks
David
pHash is one solution.
There are others but that mainly depends on your requirements: do you only want to identify identical images, if not, what types of transformations do you want to be able to capture etc.
In general you should look for near duplicate image search.
#david-jennings there are numerous methods to look for similar images in libraries. Remember that google already does this in google images.
Your problem falls under the scope of Content Based Image Retrieval (CBIR), which aims at looking for images with similarities in their content. MPEG-7 is a standard established many years ago to address these issues and the research field is very active with new techniques being developed constantly.
The main idea in CBIR is to extract some kind of a signature from an image and try to match it with all previously extracted signatures of all images in your database. Which method to use depends upon the specifics of your problem... According to your initial post I suppose that probably the use of SHIFT is going to do the work for you...
You may implement such a system using OpenCV with C/C++/Java/etc., or something more "scientific" using MATLAB.

Are there any C/C++ library for unwarping images?

What I have is a picture taken from the ceiling providing a "radially distorted"/elliptical image. I need to unwarp it and make it a regular rectangular image. How would I do this programmatically using C/C++?
A lot of applications use PanoTools for this. I believe this can also be done with OpenCV.

Image processing with barehands-ruby

I want to know how to open and manipulate a simple image file in Ruby language.
I don't need to do any advanced stuff, just things like open(), get_pixel() and put_pixel() and I don't wanna use any gem for doing that, but just to know the barehands-ruby way.
If by "simple image file" you refer to JPEG, GIF or so, it's tough luck because you'd have to implement all the decoding logic, which is far from being simple (take a look here for more info, but briefly because you really don't want to go into details ;)).
After decoding, eventually what you get is a matrix (two-dimensional array) of pixel information (usually three numbers for red, green and blue component, but other options exist). Then your methods get_pixel and set_pixel are trivial.
What Ruby folks usually do in such cases is wrap already existing C library for image manipulation, into a library such as rmagick.
Paperclip + ImageMagick did the trick. It's awesome and easy

Creating nice pdfs with ruby

I would like to create pdfs with ruby. One special need is embedding a picture into text (or a textblock), which means I need to be able to let the text flow around the image. E.g. the image should be in the rigth upper corner and the text should start left of the image and continue after the image by using the whole width of the page. How can I do this in ruby? Thank you for any suggestions!
In the past to get print quality PDFs in Ruby, I used rtex.
It's fast too, which is a real bonus.
Prawn to the rescue?
I like the html -> pdf approach. Although it is probably not the best option (prawn is) it makes it easy to design the pdf. See this website. You could also go for the approach documented at jimneath.org.
Good luck
iText is the heavyweight that will allow you to do anything you want with PDFs you can bridge to it with jRuby.
Another option I used was driving open office (it has a ui less option which you can automate from Ruby)
How about having Ruby generate some LaTeX code, then use pdflatex to produce the PDF?
Although I haven't done it myself I've seen people use a headless Open Office. You can control it from Ruby and use it to generate PDF files. You can even use an Open Office template and just fill in some elements into it.

Resources