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.
Resize a portion of an image or Curved Resize
-
- Posts: 27
- Joined: 2016-03-11T07:27:11-07:00
- Authentication code: 1151
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Resize a portion of an image or Curved Resize
Let's use an image with a grid, for clarity.
EDIT: Dodgy maths corrected (I hope).
You seem to want a simple chop and resize. Windows BAT syntax: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.
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
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.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.
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
Combine the above two methods.coolperez8 wrote:Lastly, I want ...
EDIT: Dodgy maths corrected (I hope).
snibgo's IM pages: im.snibgo.com
-
- Posts: 27
- Joined: 2016-03-11T07:27:11-07:00
- Authentication code: 1151
Re: Resize a portion of an image or Curved Resize
Ok, thankssnibgo wrote:Let's use an image with a grid, for clarity.
You seem to want a simple chop and resize. Windows BAT syntax: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.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
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.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.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
Combine the above two methods.coolperez8 wrote:Lastly, I want ...
EDIT: Dodgy maths corrected (I hope).