CentOS installation scrot

1. Install

scrot source in: http://freecode.com/projects/scrot

Download installation, you may experience a library: giblib, which in turn depends giblib imlib2. In this freecode.com can be downloaded online. How do I install, I say no more, is it all:

tar xzvf xxxx.tar.gz
cd xxxx
./configure && make
sudo make install

 

You know, what is missing in ./configure process on what to look for.

1.1 Installation libX11

When make the following error:

In file included from main.c:26:
scrot.h:29:22: error: X11/Xlib.h: No such file or directory

In the online search was the reason, you need to install: libX11-devel

sudo yum install libX11-devel

 

This error before.

1.2 Installation lmlib library

But it has emerged this error:

File /usr/local/include/giblib/giblib.h:30 included from the In,
                 from scrot.h: 51 is,
                 from main.c: 26 is:
/usr/local/include/giblib/gib_imlib.h:32:20: error: Imlib2.h: no such file or directory
this is the reason imlib library is not installed.

Download Library imlib2-1.4.4 installation, make time error:

1.2.1 lack libXext

api.c:5:34: error: X11/extensions/shape.h: No such file or directory
In file included from api.c:23:
ximage.h:5:33: error: X11/extensions/XShm.h: No such file or directory
In file included from api.c:23:

sudo yum install libXext-devel

 

There error: api.c: 30: 22: error: ft2build.h: No such file or directory

1.2.2 lack freetype

sudo yum install freetype-devel

 

报错:/usr/include/ft2build.h:56:38: error: freetype/config/ftheader.h: No such file or directory

You need the source code to install freetype job. From http://www.freetype.org/download.html install download the package.

再 make,报错:api.c:5416: fatal error: opening dependency file .deps/api.Tpo: Permission denied

Lack of authority. Sudo make it

Error 1.2.3 Link: / usr / bin / ld: can not find -lpng12

$ locate libpng12.so
/usr/lib/libpng12.so.0
/usr/lib/libpng12.so.0.49.0

 

Found under / usr / lib / two similar libraries, but that is no libpng12.so, the link to the file libpng12.so.0 /usr/lib/libpng12.so.

sudo ln /usr/lib/libpng12.so.0 /usr/lib/libpng12.so

 

再 make,报错:loader_png.c:2:17: error: png.h: No such file or directory

1.2.4 install libpng library

Go http://libpng.sourceforge.net/index.html install after downloading.

Then make, given:

loader_png.c: In function ‘load’:
loader_png.c:61: error: dereferencing pointer to incomplete type
loader_png.c: In function ‘save’:
loader_png.c:268: error: dereferencing pointer to incomplete type

 

1.2.5 png_structp not completely define the problem

Open loader_png.c file and found references to determine the type of png_structp.

        if (setjmp(png_ptr->jmpbuf))  /* 笔者:这里引用到了 png_ptr 的内部成员 */
          {
             png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
             fclose(f);
             return 0;
          }

 

png_ptr is png_structp type. Png_structp not defined in this file type, header file also contains only png.h

Find a locate png.h /usr/local/include/png.h, open the file found:

typedef struct png_struct_def png_struct;
typedef png_struct * png_structp;

 

png_struct_def structure file is not defined. To find the source file go for a search.

./Pngstruct.h defined in the source file. But png.h document does not #include "pngstruct.h", so the error.

I estimate png design libraries are not intended to expose members of the internal structure of png_struct_def, it is not defined in the png.h file, just specify the pointer and access functions. I did not expect to break away from this regulation in png_loader.c years.

That being the case, then it is easier to handle. The pngstruct.h copy files to / usr / local / include / directory down. Then #include <pngstruct.h> png_loader.c on the line in the file.
Then make, given:
loader_png.c: the In function 'Load':
loader_png.c: 62 is: error: 'png_struct' has the named NO Member 'jmpbuf'
loader_png.c: the In function 'Save':
loader_png.c: 269: error : 'png_struct' has no member named 'jmpbuf'

 

1.2.6 png_struct_def structure no problem jmpbuf

Modify the entry into force of the just, just png_struct_def does not jmpbuf this field. This is most likely caused by inconsistent version.
In my libpng version, no jmpbuf this field, but it provides a get jmpbuf from png_struct_def the function interface

jmp_buf png_jmpbuf( png_structp *png_ptr);

 

With png_jmpbuf (png_ptr) instead of direct access to the png_ptr-> jmpbuff of.

Then make, and it passed!

 

it is good! imlib2-1.4.4 is compiled by the. Come back make scrot.

Very well, also passed!

 

2. Run the dynamic library issue when libgiblib.so

After installing all successful, an error occurred while running scrot:
scrot: error loading the while the Libraries Shared: libgiblib.so.1: CAN not Open Shared Object File: No SUCH File or Directory

He said libgiblib.so.1 open. The solution is:

(1) libgiblib.so.1 find this file.

$ find /usr -name libgiblib.so.1  找到这个文件在位置
/usr/local/lib/libgiblib.so.1 
$ cat /etc/ld.so.conf  查看当前库加载路径,看有没有把这个文件包含进去
include ld.so.conf.d/*.conf 
$ echo "/usr/local/lib" >> /etc/ld.so.conf 添加库路径 
$ ldconfig  加载库文件后scrot正常使用来 
$ scrot --help 查看scrot的帮助信息 
Usage : scrot [OPTIONS]... [FILE] 
  Where FILE is the target file for the screenshot. 
  If FILE is not specified, a date-stamped file will be dropped in the 
  current directory. 
  See man scrot for more details 
  -h, --help                display this help and exit 
  -v, --version             output version information and exit 
  -b, --border              When selecting 
……

 

Well, now ready for use.

3. Use

Here is my excerpt use of some of scrot: http://blog.csdn.net/luonanqin/article/details/7770554

[General Usage] Use scrot can grab the entire desktop, a specified window, and a rectangular area selected.

Desktop crawl: scrot desktop.png, the command will crawl down current of the entire desktop, and save it as desktop.png file. You can find this image file in the current directory.
Grab the window: scrot -bs window.png, option b along the outer border of the scrot crawl crawling down the window, and s option to allow users to choose what you want to grab that window.
Gripper region: scrot -s rectangle.png, after executing this command, use the mouse to drag a rectangular area to be scrot crawled down and saved as a file rectangle.png.

[Advanced Usage] for normal crawl, based on the use scrot would be sufficient to deal with. However, under certain circumstances, the use of scrot capture images need to pay attention to some tips.
Delay fetch: scrot -cd 10 menu.png, d option command is used to delay the captured image, delay 10 represents the subsequent 10 seconds; c countdown previous option. When you crawl the menu or the command prompt, which will fully display their magic tricks.
Generating thumbnail: scrot -t 50% thumb.png, this command generates a thumbnail of the image while the captured image. T option will turn on this feature, followed by 50% zoom percentage of the original image.
Quality Change: scrot -q 70 quality.jpg, this command is used to change the grip q option image quality, values ranged from 1-100, default is 75. The higher the number, the higher the mean image quality; at the same time, the image compression rate is also lower, the greater the space.
Capture Operation: scrot action.png -e 'mv $ f ~ / images /', the image moves to the command fetch ~ / images / directory. Obviously, the functional operation of the image by the e options open, the path which represents the original $ f / filename.

The above examples are specified file name capture of the need to save. In fact, if you do not specify a name, then scrot will automatically use the current date and time in the captured image, width, height combined to generate the file name. Such as: 2012-07-21-154232_238x148_scrot.png

However, this is still less convenient. Can create a file, such as Screenshot
Touch Screenshot
vim Screenshot (vim if not installed, may be performed sudo apt-get install vim installed)
input scrot -s -e 'mv $ f ~ / screenshots' ( Note: mv $ f ~ / command sides are screenshots single quotes)
save and exit vim, and then chmod u + x screenshot

This can be performed by running scrot the screenshot file. Or may be used by scrot softlinks. For example: performing sudo ln -s ~ / screenshot scs under / usr / bin directory. After entering scs directly in the terminal with the mouse shots.

 

forward from:

https://my.oschina.net/hevakelcj/blog/176136

Guess you like

Origin blog.csdn.net/qq_35793285/article/details/81627963