Posts: 2
Threads: 1
Joined: Jul 2018
Reputation:
0
Operating system(s):
- Windows (Vista and later)
Gimp version: 2.10
07-26-2018, 10:04 AM
(This post was last modified: 07-26-2018, 10:04 AM by neverwind.)
Hello,
I've been struggling with a rather simple task for a while.
I do have an image which I want to scale in such a way, that the center of the image is less or not affected at all by the scaling than the edges.
I'll try to give a simple example with pixels, since I don't really know how to describe the effect:
1. We have an image with a 5 pixel width
2. We scale the image horizontally
3. The center column of pixels remains unaffected (not stretched)
4. The -1 and 1 columns of pixels get doubled (stretched)
5. The -2 and 2 columns of pixels get tripled (stretched more)
Is this achievable with Gimp and if so, can someone please give me a clue how to do that?
Many thanks,
Bobby
Posts: 7,133
Threads: 155
Joined: Oct 2016
Reputation:
1,004
Operating system(s):
Gimp version: 2.10
07-26-2018, 11:31 AM
(This post was last modified: 07-26-2018, 11:32 AM by rich2005.)
If you need a 'logarithmic' type of scaling there might be a plugin - don't know of one.
Using standard Gimp 2.10 tools, no easy way that I know of. My thoughts.
Progressive scaling in sections.
Start with this, Canvas is resized to accommodate the extra width. Selection of the outer '2 strips' Throw in some guides as required. screenshots: https://i.imgur.com/EjGRYpi.jpg
Scale the the selection 200 % https://i.imgur.com/tysiWzD.jpg and anchor it
Select the now resized outer strip and scale 150% https://i.imgur.com/l9yIBia.jpg Anchor it
Repeat on the other side. All very tedious.
Posts: 6,345
Threads: 274
Joined: Oct 2016
Reputation:
565
Operating system(s):
Gimp version: 2.10
(07-26-2018, 10:04 AM)neverwind Wrote: Hello,
I've been struggling with a rather simple task for a while.
I do have an image which I want to scale in such a way, that the center of the image is less or not affected at all by the scaling than the edges.
I'll try to give a simple example with pixels, since I don't really know how to describe the effect:
1. We have an image with a 5 pixel width
2. We scale the image horizontally
3. The center column of pixels remains unaffected (not stretched)
4. The -1 and 1 columns of pixels get doubled (stretched)
5. The -2 and 2 columns of pixels get tripled (stretched more)
Is this achievable with Gimp and if so, can someone please give me a clue how to do that?
Many thanks,
Bobby
This looks like lens distortion, so see if Filters>Distorts>Lens distortion does it. Otherwise, Filters>Distorts>Whirl and pinch.
Posts: 2
Threads: 1
Joined: Jul 2018
Reputation:
0
Operating system(s):
- Windows (Vista and later)
Gimp version: 2.10
(07-26-2018, 11:31 AM)rich2005 Wrote: If you need a 'logarithmic' type of scaling there might be a plugin - don't know of one.
Using standard Gimp 2.10 tools, no easy way that I know of. My thoughts.
Progressive scaling in sections.
Start with this, Canvas is resized to accommodate the extra width. Selection of the outer '2 strips' Throw in some guides as required. screenshots: https://i.imgur.com/EjGRYpi.jpg
Scale the the selection 200 % https://i.imgur.com/tysiWzD.jpg and anchor it
Select the now resized outer strip and scale 150% https://i.imgur.com/l9yIBia.jpg Anchor it
Repeat on the other side. All very tedious.
Thanks, Rich. That's exactly what I need to achieve, but then again...without actually doing it manually
Posts: 7,133
Threads: 155
Joined: Oct 2016
Reputation:
1,004
Operating system(s):
Gimp version: 2.10
07-27-2018, 07:58 AM
(This post was last modified: 07-27-2018, 08:17 AM by rich2005.)
Quote:That's exactly what I need to achieve, but then again...without actually doing it manually
Guessed that might be the case. You will need to ask one of the scripting experts for advice.
You could maybe also look at ImageMagick and search for something on non-linear scaling. There might be something in
https://www.imagemagick.org/Usage/distorts/ Also ask on the IM forum.
Posts: 1,144
Threads: 178
Joined: Sep 2018
Reputation:
114
Operating system(s):
- Windows (Vista and later)
Gimp version: 2.10
I was searching for something like that and found then : https://graphicdesign.stackexchange.com/...ge-scaling
Used it on a extreme distortion with formule w*(2+1)*x/(2*w+x)
Original :
Not very detailed (but it can't in this example) but corrected after perspective correction with gimp :
Posts: 6,345
Threads: 274
Joined: Oct 2016
Reputation:
565
Operating system(s):
Gimp version: 2.10
(06-28-2021, 08:06 AM)denzjos Wrote: I was searching for something like that and found then : https://graphicdesign.stackexchange.com/...ge-scaling
Used it on a extreme distortion with formule w*(2+1)*x/(2*w+x)
Original :
Not very detailed (but it can't in this example) but corrected after perspective correction with gimp :
Except that this particular case is really what the perspective transform is used for, because making the top and bottom parallel restores the scale.
Posts: 1,515
Threads: 69
Joined: May 2021
Reputation:
167
Operating system(s):
Gimp version: 2.10
06-28-2021, 02:03 PM
(This post was last modified: 06-28-2021, 02:14 PM by PixLab.)
I just generated a grid for test purpose (Filters > Render > Patterns > Grid...)
Then
Filters > G'mic_Qt > Deformations (I'm almost sure that in the "Testing" part of G'MIC you'll find something, I did not scroll down to the Testing directory/part, it's just too huge inside)
Anyway I think there is things there to start with like...
Cartesian distortion (I tried your equation see below)
conformal maps
logarithmic distortion
pixel push
and few others which at first glance seems to not do the job, but after tweaking many sliders....
Posts: 1,144
Threads: 178
Joined: Sep 2018
Reputation:
114
Operating system(s):
- Windows (Vista and later)
Gimp version: 2.10
06-28-2021, 04:56 PM
(This post was last modified: 06-28-2021, 05:15 PM by denzjos.)
@PixLab, I used this settings (example with squares after deformation) :
(06-28-2021, 10:48 AM)Ofnuts Wrote: (06-28-2021, 08:06 AM)denzjos Wrote: I was searching for something like that and found then : https://graphicdesign.stackexchange.com/...ge-scaling
Used it on a extreme distortion with formule w*(2+1)*x/(2*w+x)
Original :
Not very detailed (but it can't in this example) but corrected after perspective correction with gimp :
Except that this particular case is really what the perspective transform is used for, because making the top and bottom parallel restores the scale.
@Ofnuts, I know how the perspective transform work, but in my case I saw after the perspective transform that the proportions of the black door on the left side was't in proportion to the real scene, so after cropping the very big result, I scaled the picture so that the black door had the right dimensions. I saw that the picture from left to right was logarithmic stretched so I searched for a solution and found the link to solve this with G'Mic-Qt. I often searched for such a tool when I make a panorama image and the proportions of the result are not right. This must do the job.
Posts: 1,515
Threads: 69
Joined: May 2021
Reputation:
167
Operating system(s):
Gimp version: 2.10
06-28-2021, 07:15 PM
(This post was last modified: 06-28-2021, 07:17 PM by PixLab.)
(06-28-2021, 04:56 PM)denzjos Wrote: @PixLab, I used this settings (example with squares after deformation) :
Yes, this looks good and also very promising as you can tweak/modify the formula for more fine tune or whatever needs.
Well done!
|