Hello,
I want to modify an image with a female head in ImageMagick (see attached image), so that the checkerboard pattern grows in size from left to right. In addition, I want to apply a wave form to the checkerboard pattern.
The example was made in Gimp 2.10. Ideally, I want to make the pixels in the portrait grow in size from left to right, but I think this is very hard to accomplish. I'm using IM 6.9.7-4 on Ubuntu 18.04.
Thanks,
Claus
Composite: Person & checkerboard pattern
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Composite: Person & checkerboard pattern
I suppose you want these operations to apply to each separate image before compositing them together.
"... grows in size from left to right" sounds like a simple perspective projection. See http://www.imagemagick.org/script/comma ... hp#distort
"...apply a wave form" see http://www.imagemagick.org/script/comma ... s.php#wave
"Ideally, I want to make the pixels in the portrait grow in size from left to right, but I think this is very hard to accomplish." Pixels are pixels. All pixels in the image are the same size. Perhaps you want some effect that seems to have variable-size pixels. I expect something like that could be done.
"... grows in size from left to right" sounds like a simple perspective projection. See http://www.imagemagick.org/script/comma ... hp#distort
"...apply a wave form" see http://www.imagemagick.org/script/comma ... s.php#wave
"Ideally, I want to make the pixels in the portrait grow in size from left to right, but I think this is very hard to accomplish." Pixels are pixels. All pixels in the image are the same size. Perhaps you want some effect that seems to have variable-size pixels. I expect something like that could be done.
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: Composite: Person & checkerboard pattern
Input:
Code: Select all
WxH=`convert Bill_Murray.jpg -format "%wx%h" info:`
ww=`echo $WxH | cut -dx -f1`
hh=`echo $WxH | cut -dx -f2`
convert Bill_Murray.jpg \
\( -size ${ww}x$((hh+80)) pattern:checkerboard -distort perspective \
"0,0 0,%[fx:-$hh] $((ww-1)),0 $((ww-1)),0 $((ww-1)),$((hh-1)) $((ww-1)),$((hh-1)) 0,$((hh-1)) 0,%[fx:+2*$hh]" \
-wave 40x$((ww/2)) -gravity center -crop ${ww}x${hh}+0+0 +repage \) \
\( -size ${hh}x${ww} gradient: -rotate 90 \) \
-compose over -composite Bill_Murray_result.jpg
Re: Composite: Person & checkerboard pattern
Hi Snibgo & Fred,
many thanks for your response to my query. That's indeed the direction I would like to take. Additionally, I discovered the command 'virtual pixels'. Would it be feasible to use this instead of an overlay checkerboard pattern? There's the method 'checker-tile'. Could that be used?
Greetings,
Claus
many thanks for your response to my query. That's indeed the direction I would like to take. Additionally, I discovered the command 'virtual pixels'. Would it be feasible to use this instead of an overlay checkerboard pattern? There's the method 'checker-tile'. Could that be used?
Greetings,
Claus
Re: Composite: Person & checkerboard pattern
Hi again,
here's the result of my attempts to use the script Fred provided. I edited the image in Gimp with the layer mode 'grain merge'.
Now I will try to improve this using 'virtual pixels'. What I'm after is to make visible that the image in question is composed of pixels.
Greetings,
Claus
here's the result of my attempts to use the script Fred provided. I edited the image in Gimp with the layer mode 'grain merge'.
Now I will try to improve this using 'virtual pixels'. What I'm after is to make visible that the image in question is composed of pixels.
Greetings,
Claus
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Composite: Person & checkerboard pattern
We can get an effect of increasing pixelation by shrinking the right side, then enlarging it with a scaling-type filter (Windows BAT syntax):
Code: Select all
magick ^
toes.png ^
-distort perspective "0,0,0,0 0,232,0,232 266,0,266,111 266,232,266,121" ^
-filter point ^
-interpolate nearest-neighbor ^
-distort perspective "0,0,0,0 0,232,0,232 266,111,266,0 266,121,266,232" ^
toes_pixelate.png
snibgo's IM pages: im.snibgo.com
Re: Composite: Person & checkerboard pattern
> Windows BAT syntax
What would that be using a Linux shell script?
Would this be correct?
Of course the numbers will have to be different.
Claus
What would that be using a Linux shell script?
Would this be correct?
Code: Select all
#!/bin/sh
convert \
Aneta_088.png \
-distort perspective "0,0,0,0 0,232,0,232 266,0,266,111 266,232,266,121" \
-filter point \
-interpolate nearest-neighbor \
-distort perspective "0,0,0,0 0,232,0,232 266,111,266,0 266,121,266,232" \
Aneta_088_pixelate.png
Claus
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Composite: Person & checkerboard pattern
That looks about right.
Here's another example, using %[fx:...] so we have fewer magic numbers.
Bill Murray's eyes are at y=421. We shrink to that y-value, plus or minus 10.
For Windows BAT, we have doubled the %%.
We could add a "-wave" at the end. Or we could apply the same distortion to an identity absolute displacement map, and blend that with identity absolute displacement map, then apply that to the input image. The possibilities are endless.
Here's another example, using %[fx:...] so we have fewer magic numbers.
Code: Select all
%IMG7%magick ^
Bill_Murray.jpg ^
-distort perspective "0,0,0,0 0,%%[fx:h-1],0,%%[fx:h-1] %%[fx:w-1],0,%%[fx:w-1],%%[fx:421-10] %%[fx:w-1],%%[fx:h-1],%%[fx:w-1],%%[fx:421+10]" ^
-filter point ^
-interpolate nearest-neighbor ^
-distort perspective "0,0,0,0 0,%%[fx:h-1],0,%%[fx:h-1] %%[fx:w-1],%%[fx:421-10],%%[fx:w-1],0 %%[fx:w-1],%%[fx:421+10],%%[fx:w-1],%%[fx:h-1]" ^
Bill_Murray_pix.jpg
For Windows BAT, we have doubled the %%.
We could add a "-wave" at the end. Or we could apply the same distortion to an identity absolute displacement map, and blend that with identity absolute displacement map, then apply that to the input image. The possibilities are endless.
snibgo's IM pages: im.snibgo.com