Dear All,
this is my first timer on this forum, but I/we use IM for quite a while now. This is basically focused to image conversion and repetitive tasks.
I came across pretty nice features and some questions did occur.
Virtual-Pixel:
Working with image distortions, I noticed that there are loots of different methods for virtual-pixel handling. As command line arguments I tried "-matte -virtual-pixel transparent" and got what I expected.
Question:
How can I get an alpha/matte like when using "transparent" as virtual-pixel method, but when using "edge", "mirror" .. ?
Why:
The resulting image manipulation would be kind of documented and the area of virtual pixel could be accessed in an independent step later on.
Sparse-Color:
Making some tests I came from distortions (Shepards) to this field. I'm interested in the methods handling n-control-points, surely more than three. I provide some examples based on the settings, which I guess Anthony created himself. I only made the canvas 200x200.
Starting from the Voronoi, one can see the sectors around each point. With a blur the borders get fuzzy, depending on the blur radius.
Taking a look at the bilinear version seems to create a very small green area.
Playing around with an old AE plugin, I came across these results: BlendedBounded, BlendedNeighborhood.
And don't say the examples above are very good, but they are much closer to what I was looking for than the following examples: Inverse, Shepards.
Having come so far, I would like to say, that the sparse color concept is pretty cool. I even did not know about it before I read about the shepards distortion. The only thing missing (maybe I'm not familiar with details or overlooked something) is a method or way to get a homogeneous map via sparse color and to be able to use this method also to distort an image. That would be much better, than having a power variable, since the "power/influence" could also be defined by the area-size around a distinct control point.
Great Work, keen to go on.
Best Regards,
rengel
IM review | virtual-pixel, sparse-color and distortions
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: IM review | virtual-pixel, sparse-color and distortions
I don't know if this is useful to you, but you can easily blend the techniques. For example, a 70% blend in Lab colorspace between bilinear and shepards (power 3), Windows script:
Code: Select all
convert ^
( -size 200x200 xc: ^
-sparse-color Bilinear ^
"30,10 red 10,80 blue 70,60 lime 80,20 yellow" ) ^
( -size 200x200 xc: ^
-define shepards:power=3 -sparse-color Shepards ^
"30,10 red 10,80 blue 70,60 lime 80,20 yellow" ) ^
-colorspace Lab ^
-compose Blend -define compose:args=70 -composite ^
-colorspace sRGB ^
-fill white -stroke black ^
-draw "circle 30,10 30,12 circle 10,80 10,82" ^
-draw "circle 70,60 70,62 circle 80,20 80,22" ^
sparse_out.png
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: IM review | virtual-pixel, sparse-color and distortions
You can always apply a linear blur of any size to the results of the bilinear to get a smoother result more like what you have shown from elsewhere
convert image -blur 5x65000 blurredimage
using r=5 and sigma=65000 makes the gaussian blur a linear blur of radius=5
convert image -blur 5x65000 blurredimage
using r=5 and sigma=65000 makes the gaussian blur a linear blur of radius=5
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: IM review | virtual-pixel, sparse-color and distortions
I am not sure I understand the question or the reason. If you had a transparent outside, how would that look different if you used -virtual-pixel transparent or -virtual-pixel edge/mirror. The image would look the same. The only difference would be what is under the transparent area.How can I get an alpha/matte like when using "transparent" as virtual-pixel method, but when using "edge", "mirror" .. ?
You can do what you want by running it first with -virtual-pixel edge. Then repeat from the original image using -virtual-pixel transparent. Then convert the latter result into a binary image where everything non-transparent is white and everything transparent is black (see -fill white +opaque transparent -fill black -opaque transparent). Then put the latter binary image into the alpha channel of the -virtual-pixel edge result. (see -alpha off -compose copy_opacity -composite).
Re: IM review | virtual-pixel, sparse-color and distortions
@snibgo:
Thank you for your tip. I tried that and it looks like this..
It looks nice to me and the opportunity getting somewhere by combining different methods is fine for me. I wanted to add one more point and compare again. Starting with the modified script from snibgo.
Results (from left to right: Voronoi, Voronoi-Blur, Bilinear, Shepards, Bilinear-Shepards (Combine), BlendedBound, BlendedNeighborhood):
I would like to try for example the bilinear interpolation for a multipoint distortion. Is it possible to use a sparse color canvas as reference map for distortions or to use these interpolations for multipoint distortions?
@fmw42
Blurring the image with a fixed radius might also reduce the influence of two close distance points, which might be interesting to try but I would like to start from the basis of control points which keep their value at least at their own place.
Concerning the Virtual Pixel I simply asked myself, why the matte argument doesn't allow unpremultiplied mattes everytime the original image is altered for example by the virtual pixel option.
From left to right (-distort ScaleRotateTranslate -110):
I'm afraid Photoshop won't show the difference of the provided files correctly. But image 5 is truly not pre-multiplied, thus it keeps the filled area. I had to add the add the sRGB flag to this image to show it correctly inside of your browser.
Edit: To clarify what I mean. Most browsers will show the image also with transparent areas and do a post premultiply. If one takes image 5 and opens it in an appropriate environment, these results are shown. From left to right:
Best regards,
rengel
Thank you for your tip. I tried that and it looks like this..
It looks nice to me and the opportunity getting somewhere by combining different methods is fine for me. I wanted to add one more point and compare again. Starting with the modified script from snibgo.
Code: Select all
convert ^
( -size 200x200 xc: ^
-sparse-color Bilinear ^
"30,10 red 10,80 blue 70,60 lime 75,65 white 80,20 yellow" ) ^
( -size 200x200 xc: ^
-define shepards:power=3 -sparse-color Shepards ^
"30,10 red 10,80 blue 70,60 lime 75,65 white 80,20 yellow" ) ^
-colorspace Lab ^
-compose Blend -define compose:args=70 -composite ^
-colorspace sRGB ^
-fill white -stroke black ^
-draw "circle 30,10 30,12 circle 10,80 10,82" ^
-draw "circle 70,60 70,62 circle 80,20 80,22 circle 75,65 75,67" ^
sparse_out.png
I would like to try for example the bilinear interpolation for a multipoint distortion. Is it possible to use a sparse color canvas as reference map for distortions or to use these interpolations for multipoint distortions?
@fmw42
Blurring the image with a fixed radius might also reduce the influence of two close distance points, which might be interesting to try but I would like to start from the basis of control points which keep their value at least at their own place.
Concerning the Virtual Pixel I simply asked myself, why the matte argument doesn't allow unpremultiplied mattes everytime the original image is altered for example by the virtual pixel option.
From left to right (-distort ScaleRotateTranslate -110):
- 1, original
- 2, -matte -virtual-pixel transparent (this is premultiplied)
- 3, -matte -virtual-pixel edge (this creates a solid white matte, non premult)
- 4, -virtual-pixel edge (same as 3 without alpha/matte)
- 5, (what I expected from 3, a non premultiplied alpha/matte in one step)
- 6, the matte to the distortion
I'm afraid Photoshop won't show the difference of the provided files correctly. But image 5 is truly not pre-multiplied, thus it keeps the filled area. I had to add the add the sRGB flag to this image to show it correctly inside of your browser.
Edit: To clarify what I mean. Most browsers will show the image also with transparent areas and do a post premultiply. If one takes image 5 and opens it in an appropriate environment, these results are shown. From left to right:
- 1, image 5 from above
- 2, rgb of image 5
- 3, rgba of image 5, checker underlay to show alpha/matte
- 4, post-premultiply of image 5, now image information is lost
- 5, post-premultiply of image 5, with no checker underlay -> transparent is shown black (0)
Best regards,
rengel