Function Repository Resource:

ImageEngrave

Source Notebook

Give an image an engraved appearance

Contributed by: Mark Greenberg

ResourceFunction["ImageEngrave"][img]

returns a version of img composed of horizontal lines that vary in thickness, giving an appearance of engraving.

ResourceFunction["ImageEngrave"][img, t]

gives a result of type t.

Details and Options

ResourceFunction["ImageEngrave"][img, "Image"] returns an Image object; ResourceFunction["ImageEngrave"][img, "Graphics"] returns a Graphics object.
ResourceFunction["ImageEngrave"] converts all images to grayscale.
ResourceFunction["ImageEngrave"] can take the following options:
"ImageScale"2size ratio of ResourceFunction["ImageEngrave"][img] to img
"LineColor"Blackthe color of the horizontal lines
"LineScale"3scaling of the lines used
A smaller value of "LineScale" produces a finer engraving.
For best results, one must find a balance between "LineScale" and "ImageScale". The default works well for most images.
ResourceFunction["ImageEngrave"][img, "LineScale" 6, "ImageScale" 1] gives the same size output as the original image.

Examples

Basic Examples (2) 

Apply an engraved effect to an image:

In[1]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/2ba29b6b-7eac-410d-ae45-52d11a5c4663"]
Out[1]=

Make a graphic of the engraved image:

In[2]:=
pic = ImageResize[
ExampleData[{"TestImage", "Peppers"}], 200];
ResourceFunction["ImageEngrave"][pic, "Graphics"]
Out[2]=

Options (3) 

ImageScale (1) 

The "ImageScale" option, which has a default of 2, sets the ratio between the sizes of img and ImageEngrave[img, elem]. In most cases, when img and ImageEngrave[img, elem] are the same size, the engraving effect is too fine to be seen:

In[3]:=
pic = ImageResize[
ExampleData[{"TestImage", "Peppers"}], 200];
ResourceFunction["ImageEngrave"][pic, "Image", "ImageScale" -> 1]
Out[3]=

LineColor (1) 

The "LineColor" option uniformly sets the color for the engraved lines:

In[4]:=
pic = ImageResize[
ExampleData[{"TestImage", "House"}], 200];
ResourceFunction["ImageEngrave"][pic, "Image", "LineColor" -> Darker[Red]]
Out[4]=

LineScale (1) 

The "LineScale" option, which has a default of 3, sets the thickness of the horizontal lines:

In[5]:=
pic = ImageResize[
ImageCrop[
ExampleData[{"TestImage", "Girl"}], {144, 144}], {200, 200}];
ResourceFunction["ImageEngrave"][pic, "Graphics", "LineScale" -> 6]
Out[5]=

Neat Examples (1) 

Get an interesting mesh effect by combining vertical and horizontal engravings:

In[6]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/fe16a6f2-40ea-41da-bfaf-8961e439dc7b"]
Out[6]=

Publisher

Mark Greenberg

Version History

  • 1.0.0 – 03 May 2021

Related Resources

License Information