No consistent effect across different resolutions

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
coloring
Posts: 82
Joined: 2015-08-27T10:17:36-07:00
Authentication code: 1151

No consistent effect across different resolutions

Post by coloring »

I am trying to get specific look in pictures that will later be assembled as an animated video.
The trouble starts when applying the same process on a larger resolution. example below

Image

This is the process I am using

Code: Select all

convert  in.png -remap colors.png -posterize 2 -ordered-dither hlines2x2a,0.9  out.png
From thresholds.xml

Code: Select all

<threshold map="hlines2x2a">
    <description>Horizontal Lines 2x2 (bounds adjusted)</description>
    <levels width="2" height="2" divisor="10">
        3   3
        9   9
    </levels>
  </threshold>
Version.

Code: Select all

7.0.7-10
All I want is someone to help me get the same effect presented in the 540p example,on the 1080p variant.
Thanks in advance.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: No consistent effect across different resolutions

Post by fmw42 »

I am not an expert on dithering. But I believe it will be scale dependent. Perhaps you need to create a larger dither pattern. Perhaps someone who knows more about dithering than I will be able to help further. It would be useful if you post your original images separately at full resolution, so others can experiment with them. Also please always provide your IM version and platform.
coloring
Posts: 82
Joined: 2015-08-27T10:17:36-07:00
Authentication code: 1151

Re: No consistent effect across different resolutions

Post by coloring »

fmw42 wrote: 2017-11-11T17:11:21-07:00 I am not an expert on dithering. But I believe it will be scale dependent. Perhaps you need to create a larger dither pattern. Perhaps someone who knows more about dithering than I will be able to help further. It would be useful if you post your original images separately at full resolution, so others can experiment with them. Also please always provide your IM version and platform.
Thanks for the fast reply.
I will supply the original image and the color pallet for the remap below.
Also dither(as in hlines2x2a) does not work seem to work on the remapped 1080p variant with values bigger than "1"(one),if you try to set it at 10 noting happens but it does work for values between 0.2 to 0.9.
Also I provided the version in the previous post but here it is again as requested.
I am opened for help on creating larger dither pattern,since that is beyond my skill and I only used the example provided by the documentation.

Code: Select all

ImageMagick-7.0.7-10-Q16-x64-dll Windows 7 x64 
Original image
Image

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

Re: No consistent effect across different resolutions

Post by fmw42 »

Why does your color pallet have two parts? Is that intended?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: No consistent effect across different resolutions

Post by fmw42 »

With IM 7, you should change convert to magick.

Code: Select all

magick  in.png -remap colors.png -posterize 2 -ordered-dither hlines2x2a,0.9  out.png
coloring
Posts: 82
Joined: 2015-08-27T10:17:36-07:00
Authentication code: 1151

Re: No consistent effect across different resolutions

Post by coloring »

fmw42 wrote: 2017-11-11T17:23:22-07:00 With IM 7, you should change convert to magick.

Code: Select all

magick  in.png -remap colors.png -posterize 2 -ordered-dither hlines2x2a,0.9  out.png
Alright please let me test it out

fmw42 wrote: 2017-11-11T17:22:21-07:00 Why does your color pallet have two parts? Is that intended?
Its just a 9bit RGB 512 colors.
You can cut the bottom nothing will change.
Also I edited some things in my previous post so please re-read it just in case.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: No consistent effect across different resolutions

Post by fmw42 »

Since your 1080 image is larger than your 540 by about 2 in height, have you tried

<threshold map="hlines4x2a">
<description>Horizontal Lines 4x2 (bounds adjusted)</description>
<levels width="4" height="2" divisor="10">
3 3
3 3
9 9
9 9
</levels>
</threshold>

Sorry, I know little about dithering and how the divisor works. You may have to create your own new dither pattern.
coloring
Posts: 82
Joined: 2015-08-27T10:17:36-07:00
Authentication code: 1151

Re: No consistent effect across different resolutions

Post by coloring »

fmw42 wrote: 2017-11-11T17:23:22-07:00 With IM 7, you should change convert to magick.
Alright so under windows all I can do from cmd is point it to magick.exe and erase "convert" after which if I execute the example you provided I get errors since "convert" is not included.
Unless I am missing something from the command line processing documentation I dont know how to just change "convert" to magick,I can only append it.

I other words

Code: Select all

C:\magick.exe convert -some parameter here-
Or it would not work at all.

fmw42 wrote: 2017-11-11T17:27:07-07:00 Since your 1080 image is larger than your 540 by about 2 in height, have you tried

<threshold map="hlines4x2a">
It doesn't work,but thanks for your try.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: No consistent effect across different resolutions

Post by fmw42 »

You have not installed IM 7 correctly, I guess. I do not use Windows, but did you check the legacy install when you installed IM 7. You have some kind of install window do you not?

Perhaps you renamed convert.exe to convert in IM 6. Note one Windows there is a Windows convert.exe also.

What happened with

Code: Select all

magick logo: logo.gif
Does that work? If not, try

Code: Select all

magick.exe logo: logo.gif
You should not use magick convert or magick.exe convert or magick.exe convert.exe. Those, if they work, call IM 6 versions and not IM 7.
coloring
Posts: 82
Joined: 2015-08-27T10:17:36-07:00
Authentication code: 1151

Re: No consistent effect across different resolutions

Post by coloring »

fmw42 wrote: 2017-11-11T18:17:18-07:00 You have not installed IM 7 correctly, I guess. I do not use Windows, but did you check the legacy install when you installed IM 7. You have some kind of install window do you not?

Perhaps you renamed convert.exe to convert in IM 6. Note one Windows there is a Windows convert.exe also.

What happened with

Code: Select all

magick logo: logo.gif
Does that work? If not, try

Code: Select all

magick.exe logo: logo.gif
You should not use magick convert or magick.exe convert or magick.exe convert.exe. Those, if they work, call IM 6 versions and not IM 7.
I reinstalled the program just in case,now every .exe you listed is present and the tool works just by using "magick".
That said the results are still the same and I still have the problem I described in the first post.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: No consistent effect across different resolutions

Post by fmw42 »

Sorry, one of the dithering experts will have to help you at this point.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: No consistent effect across different resolutions

Post by anthony »

Dithering is a pixel level process, and as such is dependant of the resolution of the image.
There is not a lot you can do about that.

Also colors that are being dithered can be effected by the resize operations, becoming smoother at lower resolutions, which makes dither work differently at pixel level. It is very difficult to control.

Fred... Dithering is delt with extensively in IM Examples, as I re-implemented the threshold dithering parts of IM so as to allow multiple posterized levels, and user designed dither (threshold) maps.

Threshold Dithering
http://www.imagemagick.org/Usage/quantize/
Ordered Dithering Development (using FX expressions)
http://www.imagemagick.org/Usage/bugs/ordered-dither/

I see you are making use of horizontal line dithers (not built into IM threshold maps)
It was a personal dither that I specifically wanted to use when I redesigned the ordered dither process.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: No consistent effect across different resolutions

Post by anthony »

fmw42 wrote: 2017-11-11T17:27:07-07:00 Since your 1080 image is larger than your 540 by about 2 in height, have you tried

<threshold map="hlines4x2a">
<description>Horizontal Lines 4x2 (bounds adjusted)</description>
<levels width="4" height="2" divisor="10">
3 3
3 3
9 9
9 9
</levels>
</threshold>

Sorry, I know little about dithering and how the divisor works. You may have to create your own new dither pattern.
You can but it only works for double the resoultion, and it can look 'blocky'.

Note that in this case you would only need to double the height, not the width as the pattern is tiled, across the image. Doesn't make a difference either way.

Also the effect will still not be the same as each pixel will be decided by the pixel colors at that location.
Ordered dithers do not have any real concept of 'neighbourhood'. each pixel is decided purely on the pixel, and the threshold level tiled onto the image at that point. So as the higher resolution image has finer and more highly detailed edges, the resulting dither will also have the same effect.

This I believe is the real problem the OP is dealing with.

Now if you were to use a larger dither pattern and blur (or use a morphlogy "erode" or other morphological operator) on the image before dithering, so to enlarge and thicken the fine details, and perhaps use a larger dither tiling patter, then you may get something that looks about right.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply