Page 1 of 1
Resize a portion of an image or Curved Resize
Posted: 2016-11-27T09:26:26-07:00
by coolperez8
So, let's say I have an image. There are three scenarios I want to try. Let's say the image is 3000 pixels in either width or height, I want to try these scenarios affecting either, but not both. The scenarios assume I am editing the height:
First, I want to try cropping the image and only resizing the bottom 500 pixels to double the size, but leaving the rest of the image unaffected.
Next, I want to try a "curved resize", basically scanning the entire image from top to bottom and resizing each Y co-ordinate individually by an increasing interger, so the top of the image would not be resized but the bottom of the image would be multiplied by 3.
Lastly, I want to try the same curved resize, but instead it would resize the entire bottom 500 pixels by 3 rather than just the last row. In other words, it's basically doing the curved resize mentioned before from 1-2500, but when it hits 2500 it resizes 2500-3000 by 3.
Re: Resize a portion of an image or Curved Resize
Posted: 2016-11-27T11:15:25-07:00
by snibgo
Let's use an image with a grid, for clarity.
coolperez8 wrote:First, I want to try cropping the image and only resizing the bottom 500 pixels to double the size, but leaving the rest of the image unaffected.
You seem to want a simple chop and resize. Windows BAT syntax:
Code: Select all
%IM%convert ^
%SRC% ^
-gravity south ^
( -clone 0 -chop 0x50 ) ^
( -clone 0 -crop x50+0+0 +repage -resize "100x200%%^!" ) ^
-delete 0 ^
-append ^
vary_scale_c.png
coolperez8 wrote:Next, I want to try a "curved resize", basically scanning the entire image from top to bottom and resizing each Y co-ordinate individually by an increasing interger, so the top of the image would not be resized but the bottom of the image would be multiplied by 3.
I think you want a variable scale in the y-direction: varying the scale between 1.0 at the top and 3.0 at the bottom.
Code: Select all
set IDENT=^
0,0,#008,^
%%[fx:w-1],0,#f08,^
0,%%[fx:h-1],#0f8,^
%%[fx:w-1],%%[fx:h-1],#ff8
%IM%convert ^
%SRC% ^
-resize 100x150%% ^
( +clone ^
-sparse-color bilinear "%IDENT%" ^
-channel G ^
-function Polynomial -0.5,1.5,0 ^
+channel ^
) ^
-compose Distort -set option:compose:args 100%%x100%% -composite ^
vary_scale_vs.png
coolperez8 wrote:Lastly, I want ...
Combine the above two methods.
EDIT: Dodgy maths corrected (I hope).
Re: Resize a portion of an image or Curved Resize
Posted: 2016-11-28T14:45:47-07:00
by coolperez8
snibgo wrote:Let's use an image with a grid, for clarity.
coolperez8 wrote:First, I want to try cropping the image and only resizing the bottom 500 pixels to double the size, but leaving the rest of the image unaffected.
You seem to want a simple chop and resize. Windows BAT syntax:
Code: Select all
%IM%convert ^
%SRC% ^
-gravity south ^
( -clone 0 -chop 0x50 ) ^
( -clone 0 -crop x50+0+0 +repage -resize "100x200%%^!" ) ^
-delete 0 ^
-append ^
vary_scale_c.png
coolperez8 wrote:Next, I want to try a "curved resize", basically scanning the entire image from top to bottom and resizing each Y co-ordinate individually by an increasing interger, so the top of the image would not be resized but the bottom of the image would be multiplied by 3.
I think you want a variable scale in the y-direction: varying the scale between 1.0 at the top and 3.0 at the bottom.
Code: Select all
set IDENT=^
0,0,#008,^
%%[fx:w-1],0,#f08,^
0,%%[fx:h-1],#0f8,^
%%[fx:w-1],%%[fx:h-1],#ff8
%IM%convert ^
%SRC% ^
-resize 100x150%% ^
( +clone ^
-sparse-color bilinear "%IDENT%" ^
-channel G ^
-function Polynomial -0.5,1.5,0 ^
+channel ^
) ^
-compose Distort -set option:compose:args 100%%x100%% -composite ^
vary_scale_vs.png
coolperez8 wrote:Lastly, I want ...
Combine the above two methods.
EDIT: Dodgy maths corrected (I hope).
Ok, thanks