It is necessary to make torn edges in the picture, an example is here . But you need to do in ImageMagick and no matter what size the image. Tell me how this can be implemented.

  • one
    ImageMagick has a script for your purpose, however I am having problems using it . Scripts written for Linux / macOS; if you are not on Windows, I think it will be easier with them. Thank. - Sasha Chernykh
  • one
    @ SashaBlack, what should be transferred in response - Anton Veselov
  • one
    Please post an example of the result directly in the question . Link is no good. - Nick Volynkin ♦

1 answer 1

1. bordereffects

border The effect that the author of the question needed, for example, in Greenshot is called the Torn edge. It can be achieved with the help of ImageMagick native commands, see the example on the official website (unfortunately, there is only one).

However, it will have to write a bit too much. In my opinion, it is much easier to use a script for ImageMagick, called bordereffects . Yes, the site with bordereffects has a huge number of free scripts - Fred's ImageMagick Scripts - which simplify working with ImageMagick.

Windows users may have problems using scripts, since they are all written under Linux / macOS. How I managed to run bordereffects , see section 3.


2. Demonstration

1. Limitations in Demo Examples

  • demonstrates a simple command run in a cygwin terminal,
  • in the examples, conversion occurs for only one image.

2. Torn edge

Source file SashaQueen.jpg :

Original file

Torn edge effect in SashaMagic.jpg file:

 bordereffects -s 25 -d 1 -c 10 -g 1 -p 1 SashaQueen.jpg SashaMagic.jpg 

Torn edge

The optimal option values ​​vary depending on the size of the images.

3. Examples of bordereffects options

The values ​​of the options, except for the one in question, remain the same as in the example with the Torn edge.

  1. -d - density . For large values ​​(in the example -d 50 ) the images will look like this:

Density

  1. -g - granularity . For large values ​​(in the example -g 50 ) the images will look like this:

Granularity

  1. -c - curviness . For small values ​​(in the example, -с 1 ), the images will look like this:

Curviness

For detailed descriptions of commands and more examples, see the bordereffects website .


3. Run Fred's ImageMagick Scripts on Windows

Fred In Cygwin on the example of bordereffects . For the rest of the scripts, the actions are about the same.

1. Software and hardware environment

Tested personally on

  • Windows 10 64-bit Enterprise LTSB EN,
  • ImageMagick 7.0.4-3 Q16 x64 2017-01-07,
  • Cygwin 2.6.1,
  • cyg-get 1.2.1.

Bash for Windows can also be used to run on 64-bit Windows, however BSC is not supported in Windows LTSB at the time of writing this message.

2. Installation and configuration

Install Cygwin and cyg-get . Download bordereffects from the official site to the folder that is in the PATH user variable or add the folder with bordereffects to the PATH user variable - this is convenient to do through the Rapid Environment Editor .

Open the bordereffects file in any advanced text editor β†’ we do by turning on search / replace with regular expressions for \bconvert\b - magick , because Windows has a native convert command , β†’ we do for \bidentify\b - magick identify β†’ save the file.

3. Work at Cygwin

We open the Cygwin terminal - to launch Cygwin commands, a specialized terminal is needed, you can't do a regular Windows console ; I launch it with the label Cygwin64 Terminal from Wox . In the Cygwin terminal, we move to the folder where the images that need to be converted are located β†’ check that everything works by running the bordereffects , for example, bordereffects SashaQueen.jpg SashaMagic.jpg .

If messages appear in the console that some command from the bordereffects script bordereffects not start, in the preferred terminal for Windows (no longer in the Cygwin terminal), type the command cyg-get . Syntax: cyg-get firstpackage secondpackage thirdpackage . For example, after launching the bordereffects, it turned out that I did not have the bc β†’ utility installed with the cyg-get bc command.

When installing bc manually from the GnuWin website , I had bugs related to this interpreter, so I would recommend installing the missing commands via the cyg-get package manager.

  • 2
    krasaucheg) very informative. hold +1 - Urmuz Tagizade