Hexo article pictures add a watermark, do not cloud processing

Due to the Internet to find are borrowed from a third-party cloud processing to add a watermark, but I do not want to use, so he developed a plug-in

Hexo add a picture watermark Github Address

Currently in direct plug- hexoofficial online search

The following content is in Githubthe copied, the official version of my blog is currently mounted in my Githubwarehouseblog

Hexo static for a blog site to add a picture watermark is generated.

Original does not have any impact, read in the original static page website building process, output watermarked images.

Does not exist in the original building static sites, there is only the watermark image.

Be sure to read the last hints matters, contain the situation and support the existing version of the feature will be added

Using npmPlug

npm install hexo-images-watermark

In the site configuration file _config.ymlthe following configuration:

watermark:
    enable: true
    textEnable: true
    rotate: -45
    gravity: centre

In hexo generatewill automatically run when you _postadd the watermark image in the catalog, new pictures will be placed in publicthe position corresponding directory.

Necessary configuration parameters

enable

Default value : None
Description : truewill be executed pictures add a watermark, falsewill not perform add

textEnable

Default value : false
Description : whether to add a text watermark (❌ Warning: does not currently support text and pictures at the same time add a watermark)

imageEnable

Default value : false
Description : Whether to use pictures to add a watermark (❌ Warning: does not currently support text and pictures at the same time add a watermark)

Other parameters

text

Default value : use profile url, url directly display the name of the author once does not exist (SpiritLing)
Description : When you use the text is too long, once converted image is larger than be watermarked image size, an error occurs.

color

Default value : rgb (169,169,167)
Description : Color can be used rgb, rgba, # xxxxxx and red style name. ⚠️ valid only for text

gravity

Default value : southeast
Description : Why place the watermark position direction, over north-west left and right to determine the East

Parameter values ​​are available:

Types of Explanation
centre central
north north
north east
north south
north oo
north northeast
north southeast
north southwest
north northwest

fontSize

Default value : 18
Description : Text size, ⚠️ valid only for text

watermarkImage

Default value : watermark.png
Description : watermark image, the picture is placed in the path name of the source file in the root; ⚠️ not exceed the size of any article in a picture, or an error occurs, it can be use with zoom

width

Default value : 50
Description : The image to zoom. ⚠️ valid only for image

height

Default value : 50
Description : The image to zoom. ⚠️ valid only for image

rotate

Default : 0
Description : rotation angle, such as 45representatives of 45 degrees counterclockwise, -45representative of clockwise 45 degrees

background

Default value : transparent
Description : with text and rotate to refer to a text-to-image rotation will be superfluous once the blank, set the color of these places, you can generally transparent color

Precautions ⚠️⚠️⚠️

  1. Not too long text is too large, the watermark image is not too large (too large can use the zoom, ⚠️ but the scale is global), otherwise an error will terminate generate static pages
  2. Does not support adding images and text together
  3. Currently only supports *.jpg, *.pngtwo formats pictures, and only supports source/_postspicture folder, which is the local paper pictures; they also do not support remote images
  4. Watermark image does not support file for remote and non-soucre root path is only supported *.jpg, *.pngtwo formats picture
  5. It does not support the full cycle diagram to add a watermark
  6. Please use the 1.1.xabove version 1.0.xis used when Hexo api-related test, version disorganized, use 1.0.xversion any problems, almost ignore

TODO LIST

  • [X] text watermark
    • [X] custom text, color, size
    • [] Custom fonts
    • [] Cycle support added
    • [] Overrun processing
  • [X] picture watermark
    • [X] custom watermark image
    • [] Remote watermark image
    • [] Cycle support added
    • [] Overrun processing
  • [X] position
    • [X] fixed position: nine directions
    • [] Custom top, left
  • [X] of rotation
  • [X] Zoom (Picture only)
  • [] Other formats supported

Author: SpiritLing
Disclaimer: All articles in this blog unless otherwise specified, are used BY-NC-SA 4.0 license. Please indicate the source!
Blog website
starting address

Guess you like

Origin www.cnblogs.com/spirit-ling/p/12074419.html