Question: I have a some scanned images, where the scanner appears to have introduced a certain kind of noise that I've not encountered before. I would like to find a way to remove it automatically. The noise looks like high frequency vertical shear. In other words, a horizontal line that should look like `------------` shows up as `/\/\/\/\/\/\/\/\/\`, where the amplitude and frequency of the shear seem pretty regular.

Can someone suggest a way of doing the following steps?

1. Given an image, identify the frequency and amplitude of the shear noise. One can assume that it is always vertical and the characteristic frequency is higher than other frequencies that naturally appear in the image.
2. Given the above parameters, apply an opposite, vertical, periodic shear to the image to cancel this noise.

It would also be helpful to know how these could be implemented using the tools implemented by a freely available image processing package. (Netpbm, ImageMagick, Gimp, some Python library are some examples.)

**Update:** Here's a sample from an image with this kind of distortion. Actually, this sample shows that the shear amplitude need not be uniform throughout the image. :-(
The original images are higher resolution (600 dpi).

![enter image description here](https://i.stack.imgur.com/FvH5g.jpg)

Answer: 
Second parameter of [imagejpeg](http://php.net/imagejpeg) is save path.

```
imagejpeg($dst_r, $src1,$jpeg_quality);

```
Pass a filename to [`imagejpeg`](http://php.net/imagejpeg):

```
imagejpeg($dst_r, $src1, $jpeg_quality);

```