Filters reverse engineering

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
debug
Posts: 8
Joined: 2014-03-04T03:46:34-07:00
Authentication code: 6789

Filters reverse engineering

Post by debug »

Hello,

I'm looking for somebody who will help me to do the reverse engineering for the filters applied to the following images:

Image
Image

Image
Image

Image
Image

Image
Image

Image
Image

Thanks.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Filters reverse engineering

Post by snibgo »

The main effects are crop and resize, obviously.

Other effects are more subtle, and are masked by jpeg compression. There may be unsharpening. The building may have tonal expansion. The clapping woman has colour shift, or perhaps just increased saturation. The final image has some smoothing.
snibgo's IM pages: im.snibgo.com
debug
Posts: 8
Joined: 2014-03-04T03:46:34-07:00
Authentication code: 6789

Re: Filters reverse engineering

Post by debug »

snibgo wrote:The main effects are crop and resize, obviously.

Other effects are more subtle, and are masked by jpeg compression. There may be unsharpening. The building may have tonal expansion. The clapping woman has colour shift, or perhaps just increased saturation. The final image has some smoothing.
Yes crop/resize are main effects, but more interesting for me are the colors, contrast, levels correction and some blur / smoothing / unsharpening. All of these images were processed by same script (that I believe based on histogram analysis and correction).


P.S I'm ready to pay 500 usd by paypal to everyone who will help me to create the full automatic script with same results.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Filters reverse engineering

Post by fmw42 »

Do you have access to the source code for the script? What platform and what version of IM are you using?

I tried this on the first image and it looks close. You can adjust the -contrast-stretch arguments if you want and the unsharp masking.

Code: Select all

convert 1_orig.jpg -contrast-stretch 0.1% -resize 240x180 -unsharp 0x1 1_proc.jpg
debug
Posts: 8
Joined: 2014-03-04T03:46:34-07:00
Authentication code: 6789

Re: Filters reverse engineering

Post by debug »

fmw42 wrote:Do you have access to the source code for the script? What platform and what version of IM are you using?

Unfortunately, I don't have it, i can only see the results of this script.
If I had a source code, my question wouldn't be posted here :)

Version: ImageMagick 6.7.0-10 2011-07-31 Q16, Linux or FreeBSD
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Filters reverse engineering

Post by fmw42 »

Version: ImageMagick 6.7.0-10 2011-07-31 Q16
What platform? Linux/Mac/Windows? If on windows, you may need to use %% rather than %

Test my command and see if that is close?
debug
Posts: 8
Joined: 2014-03-04T03:46:34-07:00
Authentication code: 6789

Re: Filters reverse engineering

Post by debug »

fmw42 wrote:
Version: ImageMagick 6.7.0-10 2011-07-31 Q16
What platform? Linux/Mac/Windows? If on windows, you may need to use %% rather than %

Test my command and see if that is close?
Linux
debug
Posts: 8
Joined: 2014-03-04T03:46:34-07:00
Authentication code: 6789

Re: Filters reverse engineering

Post by debug »

I've tried it now, it works, but not for all.

Example

My result
Image

Original result
Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Filters reverse engineering

Post by fmw42 »

try this and adjust the contrast-stretch a bit more when needed

Code: Select all

convert 1_orig.jpg -auto-level -auto-gamma -contrast-stretch 0.1% -resize 240x180 -unsharp 0x1 1_proc3.jpg
or

Code: Select all

convert 1_orig.jpg -equalize -auto-level -auto-gamma -resize 240x180 -unsharp 0x1 1_proc4.jpg
or this with no contrast stretch

Code: Select all

convert 1_orig.jpg -auto-level -auto-gamma -resize 240x180 -unsharp 0x1 1_proc5.jpg
debug
Posts: 8
Joined: 2014-03-04T03:46:34-07:00
Authentication code: 6789

Re: Filters reverse engineering

Post by debug »

fmw42 wrote:try this and adjust the contrast-stretch a bit more when needed
Thank you for your answers.

1. The main problem is to understand when more contrast-stretch is needed automatically for bulk processing.
2. I have tried all of the codes from your previous message, the original result is better.
3. In addition, I see on the original result some blur /smoothing filter applied. You can see it if you pay attention to the skin of the lady or the trees on the 1_res.jpg.


Original result
Image

Code: Select all

convert 7_orig.jpg -contrast-stretch 0.1% -resize 240x180 -unsharp 0x1 7_proc.jpg
Image

Code: Select all

convert 7_orig.jpg -auto-level -auto-gamma -contrast-stretch 0.1% -resize 240x180 -unsharp 0x1 7_proc3.jpg
Image

Code: Select all

convert 7_orig.jpg -equalize -auto-level -auto-gamma -resize 240x180 -unsharp 0x1 7_proc4.jpg
Image

Code: Select all

convert 7_orig.jpg -auto-level -auto-gamma -resize 240x180 -unsharp 0x1 7_proc5.jpg
Image
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Filters reverse engineering

Post by snibgo »

For the smoothing, I think this is close, for all the images. Windows script. The two commands could be combined into one. If further experiments show that the two blur amounts 0x2 are correct, it would need doing only once.

Code: Select all

convert ^
  %1_orig.jpg ^
  ( +clone -blur 0x2 ) ^
  -compose Difference -composite ^
  -grayscale RMS ^
  -auto-level ^
  -auto-gamma ^
  -blur 0x20 ^
  -contrast-stretch 25x25%% ^
  -negate ^
  mask.png

convert ^
  %1_orig.jpg ^
  ( +clone -blur 0x2 ) ^
  mask.png ^
  -composite ^
  %1_masked.png
snibgo's IM pages: im.snibgo.com
debug
Posts: 8
Joined: 2014-03-04T03:46:34-07:00
Authentication code: 6789

Re: Filters reverse engineering

Post by debug »

snibgo wrote:For the smoothing, I think this is close, for all the images. Windows script. The two commands could be combined into one. If further experiments show that the two blur amounts 0x2 are correct, it would need doing only once.
I get the following error on Windows

Z:\work\imagemagick>convert 1_orig.jpg ( +clone -blur 0x2 ) -compose Diffe
rence -composite -grayscale RMS -auto-level -auto-gamma -blur 0x20 -co
ntrast-stretch 25x25% -negate mask.png
convert.exe: unrecognized option `-grayscale' @ error/convert.c/ConvertImageComm
and/1626.


Z:\work\imagemagick>convert 1_orig.jpg ( +clone -blur 0x2 ) mask.png -co
mposite 1_masked.png
convert.exe: unable to open image `mask.png': No such file or directory @ error/
blob.c/OpenBlob/2614.
convert.exe: unable to open file `mask.png' @ error/png.c/ReadPNGImage/3641.

Z:\work\imagemagick>
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Filters reverse engineering

Post by snibgo »

You are using v6.7.0, a very old version, before "-greyscale RMS" was available. I suggest you upgrade.
snibgo's IM pages: im.snibgo.com
debug
Posts: 8
Joined: 2014-03-04T03:46:34-07:00
Authentication code: 6789

Re: Filters reverse engineering

Post by debug »

I have applied the script, but it seems that there are something different was used.

Source 1

Image
Masked
Image

Original Result
Image

Source 7
Image

Masked
Image

Original Result
Image
Post Reply