Imagemagick add space between letters/clusters of pixels? - imagemagick

I'm on Windows 10, using Imagemagick version 7.1.0 Q16-HDRI (64-bit).
I would like to add a little white space between letters on an image like this:
Here is the same image, which I edited using paint. I moved each letter a little bit to the right. It's a tiny difference, but it's there:
I just want to add white space and therefore increasing the space between the letters.
I think that using "Connected Components" can do this, but after googling and trying various things, I just can't figure it out.

Related

unicode circles with varying size on ios chrome

I am using the black and white circle in my project when I noticed that on ios chrome the white circle is larger than the black circle.
● - U+25CF
○ - U+25CB
In a desktop environment the circles appear to be the same size but have slightly different heights. The difference is not noticeable.
I am trying to make these circles the same size on ios chrome.
I feel like I have eliminated any variables and that the browser is responsible for the different sizes of these circles.
photo
Actually, as far as unicode is concerned, all characters are font dependant. When a certain character is not available, it is picked from a fallback font.
If you had not configured a custom font, or if these chars are not available in the font you picked then the different sized circles are in the default font used by chrome/ios.
So, you have two ways to go: either find a font that have the characters drawn in a way that suits you, and force that, or give-up using unicode characters for these glyphs and use inline images instead.
You could make use of SVG drawings which can be encoded within the HTML markup itself, that will ensure a consistent look.

ImageMagick: Non-linear stretching an image along one axis

When downloading images from the METEOR M-2 satellite, the image is compressed near the edges. This is corrected by a windows utility called SmoothMeteor. The problem with this app is that it's windows only, and doesn't seem to have a batch mode.
Is it possible to use ImageMagick to stretch an image only along the X axis, so that in the center there is no stretching, but the closer it is near the border, the more stretching is applied?
An example is provided here:
Notice how the center of the map is largely unaffected but the clouds near the left edge look about 4 times wider than the original.
I would guess this is like a pincushion transformation but only on the X axis, but I'm not sure if I'm even in the right track.
What is your platform? If on Unix-like (Linux, Mac OSX, Window 10 Unix or Windows w/Cygwin), then I have a bash shell script calling ImageMagick, called "xpand", that does what you ask. See my web site at http://www.fmwconcepts.com/imagemagick/index.php
Input:
xpand -d 350 -m horizontal img.png result.png
-d can be either a dimension or an aspect ratio (w:h). I note that my approach (a 2nd order stretch) seems to stretch the result a bit more than your SmoothMeteor tool.

How can I convert image background pattern?

On this similar thread they have been proposed solutions to convert the background color of some image to transparent.
But sometimes the background is a simple pattern, like in this case:
Note the square background pattern.
When processing images, the background does often need to be removed or changed, but firstly you need to detect it (i.e: change its color, or making it transparent). For example, on the above image example, I would like to obtain:
How can I detect/change a specified pattern inside an image?
GUI solutions accepted.
Open source solutions preferred (free at least required).
The simplest solution will be preferred (I would like to avoid installing some hundreds of MB program).
Note: I was thinking about posting this question at Photography
StackExchange site, but I would rather say the mind of a programmer (I
could need to edit dozens of such images) is more close to what I
want. I am not an artist.
This is not a fully developed answer, but it does go some way towards thinking about a method - maybe someone else would like to develop it...
If, as you say, your pattern is specified, you know what it is - good, aren't I? So, you could look for the "Minimum Repeating Unit" of your pattern in your image. In your case it is a 16x16 grid like this:
Now you can search for that pattern in your image. I am using ImageMagick at the command-line, but you can use other tools if you prefer. ImageMagick is installed on most Linux distros and is available for OSX and Windows for free. So, I search for that grid in your globe image and ImageMagick gives me an output image showing white dots at the top-left corner of every location where the two images match:
compare -metric ae -dissimilarity-threshold 1.0 -compose src -subimage-search globe.gif grid.png res.png
That gets me this in file res-1.png
Now the white dots are where the 16x16 "Minimum Repeating Unit" is found in the image, but at the top-left corner so I shift them right and down by 8 pixels to the centre of the matching area, then I create a new output image where each pixel is the maximum pixel of the 16x16 grid in which it existed before:
convert res-1.png -roll +8+8 -statistic maximum 16x16 z.png
I can now invert that mask and then use it to set the opacity of the original image, thereby blanking areas that matched the "Minimum Repeating Unit":
convert globe.gif \( z.png -negate \) -compose copy_opacity -composite q.png
No, it's not perfect, but it is an idea for an approach that could be refined...

Get text from image with ImageMagick and Tesseract

I wanted to know if anyone has ever used Tesseract with ImageMagick to get precise text from image. My main concern is with the small font texts present in an image (or some text that are not clearly visible). The only way I am able to retrieve those unclear texts are by modifying the image by ImageMagick like - by scaling the image, sometimes cropping the image....
I wanted to know if someone has integrated ImageMagick and Tesseract to create even powerful tool?
Till now, I have come up with a script that can search the text in the image... The script uses imagemagick and tesseract. The script is still under development, but you can look at it here

Best way to programatically fill in a white border with a black border on images

I have over 100k in images that at one time were cropped and had a white border applied to them. I'm looking for the best way to programmaticly process each image so that I can detect the white borders and either crop the border or fill in the border with black instead. Would I need to use something like OpenCV or just plain old GDI? I've attached an image for reference.
What I have to work with (White borders are there, trust me):
http://cdn-images.hollywood.com/site/SO_3666231.jpg
Plain old GDI should work just fine, except for one thing - I don't know how to make GDI save an image back to a file. When I've had to do it in the past I've written a .BMP file in pieces, which wouldn't work for a JPEG. Time for a new question?
You're going to need a two step process - first measure the white borders, then copy the image to a new image to get rid of them.
Starting with a JPEG image introduces two small problems. First is that the image will contain some decoding artifacts, and white won't always be an RGB value of (255,255,255). You'll need to establish a threshold, such as (250,250,250) and see how that works; if it doesn't catch all of the borders, you'll need to try a lower threshold. Second is that resaving the image as a JPEG will introduce additional artifacts, lowering the quality of the image. Hopefully this will be within acceptable limits, but only you can be the judge of that.
I'm sorry that this isn't really an answer, perhaps more like 1/4 of an answer. I hope you find it useful.

Resources