It is currently Mon Jul 22, 2024 12:25 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Best interpolation method for Downscale ?
PostPosted: Tue Sep 18, 2012 8:55 am  (#1) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
Scale up and down is quite different, and require different method
as example gimp was using the chosen interpolation when scaling up, but not when scaling down (the user option was ignored , not sure if that was changed , it was not a bug but a design )

anyway the question is, between this 6 interpolation methods what may be the most adapt to scale down ?

| 0=none | 1=nearest | 2=average | 3=linear | 4=grid | 5=bicubic | 6=lanczos

and BTW what is used by gimp for downscale ?
(that again is not that apparently chosen by the user )

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Tue Sep 18, 2012 9:25 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14725
Location: USA
I always use bicubic but that doesn't mean it is the best way.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Tue Sep 18, 2012 9:51 am  (#3) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
I don't know if they've improved it in v2.8, but in the past I was not pleased with the way GIMP scaled down images so I did any major downscaling in Inkscape.

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Tue Sep 18, 2012 9:54 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
For scaling down in G'MIC, you should use 'average', which is the interpolation method only useful for scaling down (when scaling up with this method, it is equivalent to 'nearest neighbors').


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Tue Sep 18, 2012 10:04 am  (#5) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
Ronounours wrote:
For scaling down in G'MIC, you should use 'average', which is the interpolation method only useful for scaling down (when scaling up with this method, it is equivalent to 'nearest neighbors').
I can't find the scaling filter in G'MIC. (It would be so useful to have a Search or an Index in G'MIC).

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Tue Sep 18, 2012 10:31 am  (#6) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
Ronounours wrote:
For scaling down in G'MIC, you should use 'average', which is the interpolation method only useful for scaling down (when scaling up with this method, it is equivalent to 'nearest neighbors').


Thanks ! this solve
Oregonian wrote:
]
I can't find the scaling filter in G'MIC. (It would be so useful to have a Search or an Index in G'MIC).


In the plugin there are 2 filters to UPscale (in the Enhance menu) but none to downscale.

anyway gmic framework has many commands that may be used to downscale, that may even be used directly from the plugin
(using the "custom code" filter)

There is not a filter to downscale but in case requested should be easy get one.

I am trying to combine 3 steps that combined works very well with M3D renders but should also work nicely on photo WITH SIMILAR characteristic: strong aliasing and very tiny but sharp noise .
The sharpness of noise and jagging seems confuse most of smart denoising method
render bigger i.e. 4800x3200, apply a slight gaussian blur, scale down from 3200x2400 to 2400x1800,and give a subtle sharpening seems to fix very well
(well of course render a double size cost at least 4 times more , but result is still better of the more used method :
just render at double size and save scaled down directly from Mandeldelbulb3D .

oppss i was almost losing my point Oregonian, i try to combine 3 commands,but then i may easily extract 1,
a filter to scale down, as a selfstanding downscale filter.

only question which to chose gmic offers plenty of options

i was looking to 1 that always preserve the image ratio because would reflect in very essential and simple interface ,
but allow different scaling for H and W, would not add much complexity

Once there is a gmic command , create a correspondent filter for the plugin is very simple

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Tue Sep 18, 2012 11:14 am  (#7) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4757
AFAIK Gimp has "nearest neighbor" (aka "none"), linear, cubic, and sinc. There is no good reason these days to not use sinc by default (used to be compute-intensive, but computers are faster now).

However, all these methods do work on the original layer and so are not immune to spatial frequency folding, which can lead to artifacts (aliasing, moiré...). Proper scaling down should be done after proportional blurring.

These interpolation methods all have they own spatial frequency responses that may exacerbate the artefacts in some specific images if no pre-blurring is used. The better methods (sinc, cubic) that keep the more high frequency components are the more likely to misbehave in that case.

_________________
Image


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Tue Sep 18, 2012 11:56 am  (#8) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
Quote:
These interpolation methods all have they own spatial frequency responses that may exacerbate the artefacts in some specific images if no pre-blurring is used.


ahh so the idea of blur before downscale has some technical grounding !
i was sort of surprised to see that a moderate pre blur seems to make the scaled down result more sharp.

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Tue Sep 18, 2012 3:08 pm  (#9) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4757
PhotoComix wrote:
ahh so the idea of blur before downscale has some technical grounding !


Very much so: http://en.wikipedia.org/wiki/Aliasing

_________________
Image


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Tue Sep 18, 2012 4:08 pm  (#10) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12535
gluas decimation is the best downsizer that I've ran across. GIMP lanczos does a pretty good job too imo. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Tue Sep 18, 2012 5:03 pm  (#11) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
hu..i never try glua decimation

as far from gimp i believe it still ignore user options when downscaling,so lanczos as bicubic is only used to scale up

that makes sense ,it is a method to guess at best pixels to add , not to remove

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Tue Sep 18, 2012 5:24 pm  (#12) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4757
PhotoComix wrote:
hu..i never try glua decimation

as far from gimp i believe it still ignore user options when downscaling,so lanczos as bicubic is only used to scale up

that makes sense ,it is a method to guess at best pixels to add , not to remove

Hmmm. I remember testing the varoius methods in 2.6 after getting hit by aliasing in downscaling, and Sinc and Cubic did give different results.

<fumbles in the directories>

Yes here it is... also shows the effect of pre-blur:

Attachment:
Reduction-en.jpg
Reduction-en.jpg [ 80.61 KiB | Viewed 3608 times ]

_________________
Image


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Tue Sep 18, 2012 10:55 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12535
I've discovered that pre-blur then downscale then optional re-sharpening if need be is the best way too ofnuts. Keeps aliasing issues down. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Wed Sep 19, 2012 4:22 am  (#14) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
ofnuts wrote:
PhotoComix wrote:
hu..i never try glua decimation

as far from gimp i believe it still ignore user options when downscaling,so lanczos as bicubic is only used to scale up

that makes sense ,it is a method to guess at best pixels to add , not to remove

Hmmm. I remember testing the varoius methods in 2.6 after getting hit by aliasing in downscaling, and Sinc and Cubic did give different results.

<fumbles in the directories>

Yes here it is... also shows the effect of pre-blur:

Attachment:
Reduction-en.jpg


Well seems you are right, i remember to have followed a tread on the developer list were was explained why were not used interpolation methods when downscaling, but something must be changed from then.

Now i get all info i was needing, i just hope to maintain the focus the time sufficient to write the a filter

PS in your example blur 4x4 stand for gaussian blur of 4px on both axis ?

i ask because i experimented much lower values (very seldom more then 2 usually less as 1.5) to scale down at 50%

there is some simple way to calculate the best amount of blur ?

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Wed Sep 19, 2012 4:44 am  (#15) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4757
PhotoComix wrote:
ofnuts wrote:
PhotoComix wrote:
Well seems you are right, i remember to have followed a tread on the developer list were was explained why were not used interpolation methods when downscaling, but something must be changed from then.

Now i get all info i was needing, i just hope to maintain the focus the time sufficient to write the a filter

PS in your example blur 4x4 stand for gaussian blur of 4px on both axis ?

i ask because i experimented much lower values (very seldom more then 2 usually less as 1.5) to scale down at 50%

there is some simple way to calculate the best amount of blur ?

Yes, 4x4 is blur "4px" in Gaussian blur. Normally, you have to filter out any thing that is close to or smaller than one pixel in the final output. Which means that to downscale 4x, you have to apply a 4px Gaussian blur. Pretty simple, isn't it? In fact the actual Gaussian blur isn't applied in "pixels", but that "measure" of the blur pretty much indicates what it makes.

_________________
Image


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Wed Sep 19, 2012 7:23 am  (#16) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14725
Location: USA
Probably the best way to downsize would be small downscales in steps with blurs in between each step?
Something like the step scale script but with the added blur steps.
How would you know the blur amount in that case?
blur = 2 pixels
downscale = ?

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Wed Sep 19, 2012 7:28 am  (#17) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
ofnuts wrote:
Yes, 4x4 is blur "4px" in Gaussian blur. Normally, you have to filter out any thing that is close to or smaller than one pixel in the final output. Which means that to downscale 4x, you have to apply a 4px Gaussian blur. Pretty simple, isn't it? In fact the actual Gaussian blur isn't applied in "pixels", but that "measure" of the blur pretty much indicates what it makes.


Good to know... so i guessed right 2x2 to scale down at 2:1

And if any sharpening , apply to the scaled down version , so after downscale

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Wed Sep 19, 2012 7:46 am  (#18) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4757
Rod wrote:
Probably the best way to downsize would be small downscales in steps with blurs in between each step?
Something like the step scale script but with the added blur steps.
How would you know the blur amount in that case?
blur = 2 pixels
downscale = ?


One shot (blur+scale) is enough since you can compose all that mathematically. Everything else is snake oil :)

Downscaling in steps is actually using the inherent blur of the interpolation algorithm as a low-pass filter (which is why some people find it gives better results than a one-step downscale, but without pre-blur). But it has its hazards, since this is some 8-bit processing with all associated round-off errors.

_________________
Image


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Sun Sep 23, 2012 3:15 pm  (#19) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
I did try to port this routine to a new gmic filter

Alas till now no much success

in case somebody may help to spot the error here the code till now
(btw for sure a error is in the very first line , here " -if {$1==0} -blur_xy (w/$2),(h/$3)"
but i cannot see why is wrong: w and h should be image Height and Width, $2 and $3 the new W and H, (w/$2) and(h/$3) should be positive because the filter is to downscale

#@gimp Scale Down Neat : gimp_scaledown,gimp_scaledown_preview(1)
#@gimp : sep = separator()
#@gimp : note = note ("To scale down preserving clean edges and smoothly sharpen")
#@gimp : sep = separator()


#@gimp : Scale down to = choice(" New Width and Height ","preserve_image_ratio Set new Width ","preserve_image_ratio Set new Height",)
#@gimp : New Width = float(2400,20,4800)
#@gimp : New Height = float(1800,20,3600)
#@gimp : sep = separator()



#@gimp : sep = separator()
#@gimp : Skip Post Sharpening = bool(false)
#@gimp : sep = separator()
#@gimp : note = note( "Skip Post Sharpening": if chosen will deactivate all controls below )
#@gimp : sep = separator()
#@gimp : Spatial radius = float(1.25,0,20)
#@gimp : Bilateral radius = float(30,0,60)
#@gimp : Amount = float(2.3,0,10)
#@gimp : Darkness level = float(1,0,4)
#@gimp : Lightness level = float(0.2,0,4)
#@gimp : Channel(s) = choice("All","Lightness","Value")
#@gimp : sep = separator(), Preview type = choice("Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical")
#@gimp : note = note{"\n\n<small><b>Note : </b>
#@gimp : This filter is inspired by a discussion on www.gimpchat.com
#@gimp : </small>"}
#@gimp : sep = separator(), note = note("<small>Author : <i>Photocomix;</i>. Latest update : <i>2012/9/20</i>.</small>")

gimp_scaledown :
-if {$1==0} -blur_xy (w/$2),(h/$3)
-elif {$1==1} -blur_xy(w/$2),(w/$2)
-elif {$1==2} -blur_xy(h/$3),(w/$2)
-endif

-if {$1==0}
-resize $2,$3,2
-elif {$1==1}
-resize2dx $2,2
-elif {$1==2}
-resize2dy $3,2
-endif

-if {$4==1}
-gimp_unsharp 0,$5,$6,$7,$8,$9,$10
-endif

gimp_scaledown_preview :
-gimp_split_preview "-gimp_scaledown ${1--2}",$-1

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: Best interpolation method for Downscale ?
PostPosted: Sun Sep 23, 2012 7:00 pm  (#20) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14725
Location: USA
is
-blur_xy


an actual function in GMIC or your own variable?

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Center-Based Morphing/Interpolation

2

No new posts Attachment(s) A New 3D Text Method

7

No new posts Attachment(s) Seeking method restoring colour of old photo

24

No new posts Attachment(s) Shortening mouse/keystrokes save/export script or method to implement?

41



* Login  



Powered by phpBB3 © phpBB Group