Showing posts with label Image. Show all posts
Showing posts with label Image. Show all posts

01 September 2025

How to extract texts from an image on ubuntu?

To extract English texts - 
$ sudo apt install tesseract-ocr
$ tesseract your_image_name.png extracted_text.txt 

 

To extract Simplified Chinese texts -

$ sudo apt install tesseract-ocr tesseract-ocr-chi-sim

$ tesseract your_image.tiff output_text.txt -l chi_sim

 

To extract Traditional Chinese texts -

$ sudo apt install tesseract-ocr tesseract-ocr-chi-tra

$ tesseract your_image.tiff output_text.txt -l chi_tra

 

To extract multiple languages, e.g. English and Simplified Chinese, and Traditional Chinese texts -

$ tesseract your_image.tiff output_text.txt -l eng+chi_sim+chi_tra

05 June 2024

16 September 2023

Copy text from pictures on Linux with Textsnatcher

https://www.addictivetips.com/ubuntu-linux-tips/copy-text-from-pictures-on-linux-with-textsnatcher/

$ sudo apt install flatpak

$ sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

$sudo flatpak install flathub com.github.rajsolai.textsnatcher


Step 1: With Textsnatcher open, find the “Snatch Now!” button and click on it with the mouse. After selecting this button, Textsnatcher should open up the default screenshot tool for your Linux desktop.

Note: if you use Gnome or a Gnome-based desktop environment, it will launch the Gnome screenshot tool.

Step 2: With the screenshot tool open, find the “Select an area to grab” option and click on it with the mouse. When you select this button, the screenshot tool will allow you to take a screenshot of a selected area on the desktop.

Step 3: After you’ve selected the “select an area to grab” option, your mouse cursor will become a cross icon. Click and drag over the area you wish to extract text from.

Step 4: Once you’ve selected an area on the desktop with the cursor, the screenshot tool will take a picture. It will open up a dialog box that says, “Share this screenshot with TextSnatcher?”

Select the “Share” button to share the screenshot to Textsnatcher so that it can extract the text contents of the image.

Step 5: With the screenshot exported to Textsnatcher, you should see a message that says “Checkout Clipboard.” From here, go to a text editor (or any other text field) and press Ctrl + V hotkey to paste the text.

10 September 2019

how to scale videos/images with ffmpeg?

how to scale videos/images with ffmpeg?

https://trac.ffmpeg.org/wiki/Scaling

Keeping the Aspect Ratio

If we'd like to keep the aspect ratio, we need to specify only one component, either width or height, and set the other component to -1. For example, this command line:
ffmpeg -i input.jpg -vf scale=320:-1 output_320.png
will set the width of the output image to 320 pixels and will calculate the height of the output image according to the aspect ratio of the input image. The resulting image will have a dimension of 320⨉207 pixels.

13 February 2019

How to resize a SVG image

How to resize a SVG image


There are two ways to resize a SVG image. Let’s take a look it one by one.

1. Change width and height in XML format

Open the SVG file with your text editor. It should show lines of code as below.
<svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
As you can see, width and height are defined here. So you just have to change width and height to what you want.
It’s easy! Right?
In my case, this solution didn’t work out. I wanted to scale down the size of image but the SVG image that the designer sent to me was not changeable from the file somehow. So I had to look for other ways.

2 . Use “background-size”

Another solution is to use CSS. However, setting ```width``` and ```height``` don’t change the situation.
Instead, you have to use background-size. This property specifies the size of image.
For instance, you can write like this.
i {
  background-size: 20px 30px;
}
First value (20px) specify the height of image. Second value(30px) specify the width of image.
Whenever you make an website or application, most likely you will have to use SVG image anyway. Whenever you need to resize them, please try the above two ways!

05 January 2015

Email message in Outlook is plain text (or not see images) instead of html

Tools | Trust Centre | Email Security | Read as Plain Text,
Clear the tick in front of 'Read all standard mail in plain text'.

30 June 2014

Wrap text around an image with CSS

http://www.homeandlearn.co.uk/WD/wds4p6.html

Let's see how to get the following style:
Browser showing text wrapped around an image
As you can see, the image is on the right and the text flows around it. There is also space between the image and the text.
The first thing to do is to set up a STYLE in the HEAD section of the HTML. Add the highlighted code to your own HTML:
CSS style for text wrapping
The style we've set up is called TextWrap. In between the two curly brackets we have this:
float: right;
margin: 10px;
The CSS property we need in order to move the image is called float. The float property can take three values: left, right and none. To get some space between the image and the text we can use the margin property. We've set it to 10 pixels. This will give you space around the entire image. If you only want space on specific sides of the image you can use these:
margin-left
margin-right
margin-top
margin-bottom
So we could have done this:
margin-left: 10px;
margin-bottom: 10px;
That would get us a 10 pixels margin on the left of the image and 10 pixels at the bottom.
To apply the style to the image, you need to add the CLASS attribute to the IMG tag:
<IMG SRC="york_images/york_minster_2.gif" CLASS="TextWrap">
The CLASS attribute doesn't have to go at the end. If you prefer, you can put it after the IMG tag:
<IMG CLASS="TextWrap" SRC="york_images/york_minster_2.gif" >
Just take note of where all the spaces are in the code above.
Amend your own IMG tag and add CLASS="TextWrap" to your own IMG code. Before you try it out, add a paragraph of text below the image:
<IMG class="TextWrap" SRC="york_images/york_minster_2.gif">
<P>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed at ante. Mauris eleifend, quam a vulputate dictum, massa quam dapibus leo, eget vulputate orci purus ut lorem. In fringilla mi in ligula. Pellentesque aliquam quam vel dolor. Nunc adipiscing. Sed quam odio, tempus ac, aliquam molestie, varius ac, tellus. Vestibulum ut nulla aliquam risus rutrum interdum. Pellentesque lorem. Curabitur sit amet erat quis risus feugiat viverra.
</P>
You can, of course, use your own text, and not just the Lorem ipsum text. Make sure your IMG code is above the first P tag, however.
Save your work and view the results in your browser.
There is, however, a problem with the above code. Suppose we want a second paragraph of text with another image floated on the left. We want to do this:
Browser showing text wrapped around two images
Here, the second image is nicely aligned below and to the left of the first image. The text is in the right place, too.
To achieve this, you might think of adding a second style and then applying it to the second image. Like this:
CSS code that wraps text to the left and right of two images
In the second style, we've used float: left and added a 10 pixel margin as before. In the second IMG tag, we've used the new TextWrapLeft class.
However, saving the work and refreshing gives you this in the browser:
Browser showing badly aligned text wrapping
In this version, the second image starts two thirds of the way down the first image. The text doesn't flow as we want it, as well.
The way to correct this is to use a CSS property called clear. This clears any floating elements and gets you back to the normal, default flow for browsers. The clear property can take four values: left, right, both, none. Because our first image was floated to the right, we want to clear to the right. We can add this to the second style:
CSS code that clears text wrapping
If our first image had been on the left, we would have used clear: left.