Identify image blurred or not in rails - ruby-on-rails

I am using paperclip to upload images in my rails application
Gem: https://github.com/thoughtbot/paperclip
Now I want to check the quality of image
For exa: image is blurred or not, image qaulity is low or image clicked while covering the camera lence
Is this possible in rails?
Thanks in advance

Everything is possible in Ruby. Rails is just a web framework.
If you are asking if Ruby or Rails or paperclip have something like
Image.first.blurred?
then unfortunately not. I would guess that no programming language or framework has this specific functionality build in.
But since we are software developers we can utilize tons of library's so our app is obeying to everything that we want to achieve. But first we have to teach them.
OpenCV would be a nice library for such functionality. Its used in tons of usecases when visual analyses is required. There is also a wrapper in ruby for it.
Sure for your use case you have to to build some small library for it. Here you have an example in python which sure be easily translated to ruby. When you got this working you even could implement some Model extension to enable
SomeObject.blurred?

Related

Need assistance choosing a image management gem

I am interested in building a Rails based system for handling the display and organization of large amounts of photos. This is sort of like Flickr but smaller. Each photo will have metadata associated with it. Photos will be shown in a selectable list and grid view. It would be nice to be able to load images as they are needed as well (as this would probably speed things up).
At the moment I have a test version of my database working by images loading from the assets/images directory but it is beginning to run slow when displaying several images (200-600 images). This is due to the way I have my view setup. I am using a straight loop to display the images in both list and grid layouts.
I also manually resized the thumbnails and a medium sized image from a full sized source image. I am investigating other resizing methods. Any advice is appreciated here as well.
As I am new to handling the images this way, could someone point me in a direction based on experience designing and implementing something like Flickr?
I am investigating the following tools:
Paperclip
http://railscasts.com/episodes/134-paperclip
Requirements: ImageMajick
attachment_fu
http://clarkware.com/blog/2007/02/24/file-upload-fu#FileUploadFu
Requirement: One of the following: ImageScience, RMagick, miniMagick, ImageMajick?
CarrierWave
http://cloudinary.com/blog/ruby_on_rails_image_uploads_with_carrierwave_and_cloudinary
http://cloudinary.com/blog/advanced_image_transformations_in_the_cloud_with_carrierwave_cloudinary
I'd go with Carrierwave anyday. It is very flexible and has lot of useful strategies. It generates it's on Uploader class and has all nifty and self explanatory features such as automatic generation of thumbnails (as specified by you), blacklisting, formatting image, size constraints etc; which you can put to your use.
This Railscast by Ryan Bates - http://railscasts.com/episodes/253-carrierwave-file-uploads is very useful, if you haven't seen it already.
Paperclip and CarrierWave are totally appropriate tools for the job, and the one you choose is going to be a matter of personal preference. They both have tons of users and active, ongoing development. The difference is whether you'd prefer to define your file upload rules in a separate class (CarrierWave), or if you'd rather define them inline in your model (Paperclip).
I prefer CarrierWave, but based on usage it's clear plenty of people feel otherwise.
Note that neither gem is going to do anything for your slow view with 200-600 images. These gems are just for handling image uploads, and don't help you with anything beyond that.
Note also that Rails is really pretty bad at handling file uploads and file downloads, and you should avoid this where possible by letting other services (a cdn, your web server, s3, etc) handle these for you. The central gotcha is that if you handle a file transfer with rails, your entire web application process is busy for the duration of the transfer. (For related discussion on this topic, see: Best Ruby on Rails Architecture for Image Heavy App).

how do we display an image/color in lua

I am having this problem, and I am not able to figure out the solution.
I wish to display an image in some window if possible(not necessary tough), and then move it across the page by sending events from keyboard.
The problem is I can't use LÖVE framework, as we can't integrate it into our setup.
So I would require the Lua api's to do so.
Is anyone here aware about it? Also do I have to install some kind of extra library to support color and image operations?
Thanks for sharing the knowledge.
Lua is quite a bare-bones language to start with, so there is no built in image support whatsoever. But this also goes for almost all other programing languages, image support is typically something contained in supplementary libraries.
You need to install some library providing GUI functionality (like IUP), or use an application integrating Lua with graphical libraries (like murgaLua, Löve, ...)
From the tags you attached to your question it seems that you're using an embedded platform. It might be useful for people to know which, in order to provide more useful answers.

Rendering dynamic image mock-ups in Ruby on Rails

I am trying to create an app that allows a user to create a text treatment (either by uploading a graphic or in a WYSIWYG editor), and upload it -- the app would then render the uploaded text treatment and show that, overlaid on the side of a building (for a mockup of what it would look like if it were on a billboard, building, or what-not)
I am developing the app in Ruby on Rails, and I know some image-processing libraries like RMagick, allows you to manipulate uploaded imagery in special ways, but I wanted to see if anybody had any other advice on the best way to implement this.
Sorry for the vagueness, and thank you for your time!
I do this for one of my clients. RMagick is a fine choice. I personally prefer GraphicsMagick, which is not quite as popular yet is better written (IMHO).
Consider using alpha channel transparency, which makes overlays especially easy. For example, use PNGs with transparent channels.

Attach 1 or more (non image) files to rails application, with having to install an image-processing library

I'm currently learning rails by creating a simple project management app. I've gotten to the point where I would like to be allow a user upload multiple files - pdfs, docs, xls etc. The user only needs to be able to attach one file at a time, but the possibilty to have multiple documents associated with a project is a must.
I've spent quite a lot of time researching my options, and it appears the two main plugins are attachment_fu and paperclip. From what I've read though, these appear to concentrate specifically on the upload and subsequent resizing of images, something I couldn't care less about. Is there a simpler way to achieve what I'm trying?
Thank you all in advance.
You might still consider using attachment_fu or paperclip as those are the "standard" libraries for such tasks. And they work fine for any kind of file.
The multi-upload can't be made without JS or Flash now. You need add some hack in your view to manage it.

What web application framework should I use for a web gallery?

I need to create a photo gallery for a website running IIS 4.0 or IIS 5.0 (im not sure which). It needs to display a low resolution version of the gallery to anyone, and it must show both the low and high resolution images for "priviledged" users. So I need access priviledges, photo albums and once the site is complete, the person I am doing this for needs to be able to upload their own images to the gallery. It also needs to have a minimal interface as it needs to be integrated into an existing website.
So I need some advice on this with the direction I should approach it.
Does anyone know if their is a customisable gallery out there that can do something like this, such as Coppermine or Jgallery or something. The alternative is to use a web framework like Ruby on Rails, CodeIgniter or Sproutcore (each which require learning a new language). The framework would be more work, but the existing galleries may not be customisable enough. The important bit is the user privileges in an admin panel.
I am relatively new to "web programming", although not new to normal/games programming. I have a few years experience with C/C++ OpenGL and Java. I have also read up on MVC etc, and did hello world with sproutcore, so I kinda get the idea. Although learning a framework is a much heavier investment.
What are your thoughts?
If you don't want to re-invent the wheel you could use Gallery2 (requirements here). It runs on IIS -- you'd just need PHP and a database. It's very configurable (including user accounts), has lots of plugins, and its open source if that's not enough. Also, the development and support communities are large and active.
you could always go the route of Dotnetnuke and then use Ventrian's Simple Gallery module (http://www.ventrian.com/Products/Modules/SimpleGallery/Demo.aspx)
Using DNN offers a ton of functionality, including the security you need, and it would save you from doing any web development.
If you are a bit more adventurous, try Smaltalk based Aida/Web and specially Aida/Scribo CMS (currently still in beta), which include Gallery so called scriblet as well. Scribo scriblets are otherwise web components which you can include directly into a text. You therefore add a gallery directly into a surronding text. See for instance a presentation as a Gallery for example.
I would recommend my own but... If it weren't for the low/high resolution thing with permissions I think it would fit the rest of your needs. I'm going to leave a link just in case you want to take a look at it:
nzFotolog
It's also open-source (although the license is not the best) and you can change it at will if you want. The code itself is clean and self-explanatory. The downside is that I haven't developed it for some time now :(
Having faced a similar dilemma myself I have to say that I found Gallery2 and Coppermine both far too all-encompassing and difficult to customise to the degree I would have wished. I ended up rolling my own using straight, procedural PHP with various bits of jQuery for the GUI fancy bits. At the same time I was able to bake in some e-commerce and data gathering for my wedding photography clients, ending up with something which exactly matched my needs. Certainly, the gallery aspects of this project were, for a complete programming (although not HTML) neophyte, the least challenging - it's exactly the sort of thing PHP is made for.
I'm now taking my first faltering steps with CodeIgniter for my next project (photoblogging software) and I can already see that the framework would make a gallery project very quick, simple and secure.
Flickr.com and their API may be suitable from what you described.
http://www.flickr.com/services/api/

Resources