GreycLab/gmic

Improvement on rescale2d

Opened this issue · 1 comments

While discussing a improvement on a discord user's code. He had to crop after using rescale in order to fit within the position he wants.

This is his code:

squeesh:
  perc=$1
  target_w=5513
  target_h=2560

  rescale2d $target_w,$target_h,2,2
  extra_x={max(0,w-$target_w)}
  pos_x={$extra_x*$perc}
  extra_y={max(0,h-$target_h)}
  pos_y={$extra_y*$perc}
  crop $pos_x,$pos_y,{$pos_x+$target_w-1},{$pos_y+$target_h-1}

By having a option to place the cropping position, this wouldn't be needed any more. I also have a command that is rep_aspect_crop_2d, which can be retired if this option were to be enabled.

I don't really get it. But if you need fine tuning for rescale, you should use the native command resize which allows to specify the x,y,z and c alignment.