What is imageMogr2 and what is it used for? - image-processing

I see that ImageMogr2 is some kind of tool used by qiniu.com (a chinese hosting provider), If some one could help me understand what it is and what similar tech e have with any other hosting provider available.

Yes.
You may see a very similar service provided by tencent cloud has exactly the same name.
its an image processing utility that can scale, crop, rotate images on-the-fly using URI-programming, which means, defining the image processing command and parameters in the request URIs and you'll get the cropped images based on the original image you uploaded before.
You can easily get their documentations and some simple examples on their website.
e.g. https://developer.qiniu.com/dora/api/1270/the-advanced-treatment-of-images-imagemogr2
but not sure if you can read Chinese.
there are similar solutions provided by a us company. e.g.
https://cloudinary.com/

Related

Any Idea something application or system using CBIR (Content Based Image Retrieval)

i'm sorry, i need your help. i have problem to find unique tecnology (apps, system, or tool) in topic CBIR. do you have any idea unique apps that can be developed using CBIR? i blind and have nothing idea about CBIR. i mean, i have search idea about CBIR, but its too ordinary, and my teacher asked me to find more attractive idea about CBIR apps. search engine image, apps to identified tourism object, that my idea, any other idea from you?
NB : CBIR Content-based image retrieval (CBIR), also known as query by image content (QBIC) and content-based visual information retrieval (CBVIR) is the application of computer vision techniques to the image retrieval problem, that is, the problem of searching for digital images in large databases (see this survey[1] for a recent scientific overview of the CBIR field). Content-based image retrieval is opposed to traditional concept-based approaches (see Concept-based image indexing).
"Content-based" means that the search analyzes the contents of the image rather than the metadata such as keywords, tags, or descriptions associated with the image. The term "content" in this context might refer to colors, shapes, textures, or any other information that can be derived from the image itself.
for using ordinary methods
https://github.com/dermotte/LIRE you may use this library this is a demo site developed
lire Demo
But if you have enough time and enthusiasm you should look deep learning topics which is all state of art works on the field done on. Forexample you may look Karpathy's NueralTalk on github https://github.com/karpathy/neuraltalk2 and the wonderful demo page

how to do image processing through bluemix

I'm a starter of IBM Bluemix and i don't know how to use image processing tools. Please help me out with this. and also please tell me how to load the images into bluemix image processing tool.
Have a check on Alchemy API of IBM Bluemix.
AlchemyAPI offers a set of three services that enable businesses and developers to build cognitive applications that understand the content and context within text and images. For instance, using AlchemyAPI, developers can perform tasks such as extracting the people, places, companies, and other entities mentioned in a news article or analyze an image to understand the contents of the photo.
AlchemyLanguage
AlchemyLanguage is a collection of 12 APIs that offer text analysis through natural language processing. The AlchemyLanguage APIs can process text and help you to understand its sentiment, keywords, entities, high-level concepts and more.
AlchemyVision
AlchemyVision understands and analyzes complex visual scenes without needing textual clues. Developers can use this API to do tasks like image recognition, scene recognition, and understanding the objects within images.
AlchemyData
AlchemyData provides news and blog content enriched with natural language processing to allow for highly targeted search and trend analysis. Now you can query the world's news sources and blogs like a database.
An example screenshot of how it looks-
They have a great tutorial here on how to Get started - Step 1.
If you are looking for image processing using Python, here is a great tutorial with simplistic steps on how to kick off.
More examples or references-
Bluemix - Tutorials Videos
Analyze notes with the AlchemyAPI service on IBM Bluemix
Getting started with the Visual Recognition service
Real Time Analysis of Images Posted on Twitter Using Bluemix
Editors' picks: Top 15 Bluemix tutorials
If you would like to use runtimes, you could use imagemagick libraries, recently added on Cloud Foundry. The binaries should be on this path
/var/vcap/packages/imagemagick/bin
Otherwise you can refer to the chosen buildpack specific options: for example with the php one you could use GD library, installing through composer utility
{ "require": { "ext-gd": "*" } }
Another opportunity could be to use a docker container instead of a runtime, which allows you to keep the scalability opportunities of Bluemix but giving you wider configuration options.
Generally speaking it depends a lot from the technology you would like to use (java/php/python etc...)

Manage Image Submissions in WordPress

I have a client WordPress website that allows users to upload custom artwork from the front end.
I use TDO Mini Forms to create the submission form, but it doesn't seem to have options for file manipulation on upload. As a result, the images are often very large, sometimes in CMYK, and have various other issues.
I've managed the size issue, to some extent, using WP's media settings, but there are two issues that have vexed me:
It doesn't address the CMYK issue (which admittedly happens very rarely, but still prompts a call from the client).
WP doesn't discard the original image, which creates huge backup files.
Is there an extension out there that better manages submitted images? Even if it involves replacing the submission form (TDO Mini Forms works well, but has been unsupported for some time), I'm looking for any solution that meets this need.
IMO, the gold standard would be a WP equivalent to ExpressionEngine's Safecracker + DevDemon's ChannelImages.
Is there anything out there? I can't be the only one looking for this.
As always, any help is greatly appreciated.
ty
Don't know if it's exactly what you need, but this may help you out:
http://www.verot.net/php_class_upload.htm
It's integrated into this plugin I used some months ago for a client:
http://wordpress.org/extend/plugins/photosmash-galleries/
The solution is a plug-in called Imsanity (http://wordpress.org/extend/plugins/imsanity/).
It still doesn't address the CMYK issue, but it does manage the file sizes, which is the more pressing issue.
It also works retroactively, so if you already have large images on your site, you can bulk resize them.

How should I go about providing image previews of sites while using Google's Web Search API?

I'm using Google's Custom Search API to dynamically provide web search results. I very intensely searched the API's docs and could not find anything that states it grants you access to Google's site image previews, which happen to be stored as base64 encodes.
I want to be able to provide image previews for sites for each of the urls that the Google web search API returns. Keep in mind that I do not want these images to be thumbnails, but rather large images. My question is what is the best way to go about doing this, in terms of both efficiency and cost, in both the short and long term.
One option would be to crawl the web and generate and store the images myself. However this is way beyond my technical ability, and plus storing all of these images would be too expensive.
The other option would be to dynamically fetch the images right after Google's API returns the search results. However where/how I fetch the images is another question.
Would there be a low cost way of me generating the images myself? Or would the best solution be to use some sort of site thumbnailing service that does this for me? Would this be fast enough? Would it be too expensive? Would the service provide the image in the correct size for me? If not, how could I change the size of the image?
I'd really appreciate answers that are comprehensive and for any code examples to be in ruby using rails.
So as you pointed out in your question, there are two approaches that I can see to your issue:
Use an external service to render and host the images.
Render and host the images yourself.
I'm no expert in field, but my Googling has so far only returned services that allow you to generate thumbnails and not full-size screenshots (like the few mentioned here). If there are hosted services out there that will do this for you, I wasn't able to find them easily.
So, that leaves #2. For this, my first instinct was to look for a ruby library that could generate an image from a webpage, which quickly led me to IMGKit (there may be others, but this one looked clean and simple). With this library, you can easily pass in a URL and it will use the webkit engine to generate a screenshot of the page for you. From there, I would save it to wherever your assets are stored (like Amazon S3) using a file attachment gem like Paperclip or CarrierWave (railscast). Store your attachment with a field recording the original URL you passed to IMGKit from WSAPI (Web Search API) so that you can compare against it on subsequent searches and use the cached version instead of re-rendering the preview. You can also use the created_at field for your attachment model to throw in some "if older than x days, refresh the image" type logic. Lastly, I'd put this all in a background job using something like resque (railscast) so that the user isn't blocked when waiting for screenshots to render. Pass the array of returned URLs from WSAPI to background workers in resque that will generate the images via IMGKit--saving them to S3 via paperclip/carrierwave, basically. All of these projects are well-documented, and the Railscasts will walk you through the basics of the resque and carrierwave gems.
I haven't crunched the numbers, but you can against hosting the images yourself on S3 versus any other external provider of web thumbnail generation. Of course, doing it yourself gives you full control over how the image looks (quality, format, etc.), whereas most of the services I've come across only offer a small thumbnail, so there's something to be said for that. If you don't cache the images from previous searches, then your costs reduces even further, since you'll always be rendering the images on the fly. However I suspect that this won't scale very well, as you may end up paying a lot more for server power (for IMGKit and image processing) and bandwidth (for external requests to fetch the source HTML for IMGKit). I'd be sure to include some metrics in your project to attach some exact numbers to the kind of requests you're dealing with to help determine what the subsequent costs would be.
Anywho, that would be my high-level approach. I hope it helps some.
Screen shotting web pages reliably is extremely hard to pull off. The main problem is that all the current solutions (khtml2png, CutyCapt, Phantom.js etc) are all based around QT which provides access to an embedded Webkit library. However that webkit build is quite old and with HTML5 and CSS3, most of the effects either don't show, or render incorrectly.
One of my colleagues has used most, if not all, of the current technologies for generating screenshots of web pages for one of his personal projects. He has written an informative post about it here about how he now uses a SaaS solution instead of trying to maintain a solution himself.
The TLDR version; he now uses URL2PNG to do all his thumbnail and full size screenshots. It isn't free, but he says that it does the job for him. If you don't want to use them, they have a list of their competitors here.

How do I resize high-res photos to thumbnails?

I have a site where a user can upload a photo. I have no idea how to handle photos. To make a thumbnail out of a large res photo, do I just resize the width and the height? Or is there a better way to do this?
If you could point me to any resources or give me any tips, that would be great.
I'm using Ruby on Rails, if that matters. I don't really want gems for this because I want to learn how to do it myself.
For some of this, "learning how to do it yourself" is going to be a significant undertaking. Resizing the image, for example. Go ahead and find an open source library (such as a gem) that resizes images and look through its source code. It's not impossible to do on your own, but a lot of that sort of thing is built on the expertise that's come before, etc. There's nothing wrong with making use of a tool somebody else has created, provided that you understand what the tool is doing.
A few points to hopefully help you out:
Go with a white-list approach of which image formats you support. Don't just let users upload anything that they call an image.
Each format you support is going to have its own standards (possibly multiple) for meta-data. Stripping out that data wholesale may or may not be a good idea. For example, a jpeg may contain its orientation in its EXIF data and if you strip that out you may be effectively rotating the image. Certain fields, such as geotagging, you may want to strip out in the effort to protect your users' privacy, etc. Again, look into existing libraries for this and see how they do it.
DO NOT implicitly trust the file name extension for determining the type of the image. It's possible for a user to construct a malicious file that isn't really an image, pass it off as an image to an unsuspecting host, and effectively open a security flaw on that host as it tries to process the file as an image. There was a question about determining file type in Ruby here, and I'm sure there's a lot more to be found on the subject.
David answered the question well, but I thought I might be able to provide some more specific information regarding your question.
Use the Paperclip gem, combined with RMagick, an ImageMagick wrapper for Ruby. You can set post-processing options and create multiple resizings.
If you really want to do it yourself, checkout the actual gem at https://github.com/thoughtbot/paperclip and you'll see how that author does it. Part of the thought behind Ruby on Rails is DRTW (Don't Reinvent the Wheel). Utilize what's out there and build on it. It will save you time, and enable you to do more in the longrun.
An alternative is to use a third party service such as http://resizer.co (I am not affiliated)
Replace a URL to an image from your site, say:
http://example.com/images/abc123.jpg
with the following (for a 200 x 200 image)
http://www.resizer.co?image=http://example.com/images/abc123.jpg&w=200&h=200
You may run into issues with distortion and the 'aspect ratio' not being maintained, but it could be a good start.

Resources