RSS/Atom feed Twitter
Site is read-only, email is disabled

Gimp-developer Digest, Vol 57, Issue 11

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

14 of 15 messages available
Toggle history

Please log in to manage your subscriptions.

improving image scale: reduction g4@catking.net 10 Jun 05:53
  improving image scale: reduction g4@catking.net 10 Jun 08:31
   improving image scale: reduction Mark Lowry 10 Jun 14:24
    improving image scale: reduction g4@catking.net 10 Jun 18:31
  improving image scale: reduction Sven Neumann 10 Jun 13:12
   improving image scale: reduction g4@catking.net 10 Jun 14:42
    improving image scale: reduction Sven Neumann 10 Jun 23:41
     improving image scale: reduction g4@catking.net 11 Jun 12:16
mailman.67208.1181493082.16... 07 Oct 20:25
  improving image scale: reduction Guillermo Espertino 11 Jun 18:04
   improving image scale: reduction Sven Neumann 11 Jun 19:34
  Gimp-developer Digest, Vol 57, Issue 11 Guillermo Espertino 12 Jun 14:25
   Separate+ plug-in Kevin Cozens 12 Jun 19:11
    Separate+ plug-in Aurimas Juška 12 Jun 19:29
   Gimp-developer Digest, Vol 57, Issue 11 Øyvind Kolås 12 Jun 22:12
g4@catking.net
2007-06-10 05:53:57 UTC (over 17 years ago)

improving image scale: reduction

Hi,

in result of some comments in #166130 I have been looking at image scaling in scale-funcs.c

It seems the needs of scale down are quite different from the interpolation of scaling up so there are certain compromises in using the same lin/cubic/lanczos list of options.

currently linear and cubic both execute the same code which just averages all source pixels, it is neither linear or cubic.

Also downscaling has different needs depending on whether the scaling is near to unity or not.

I think cubic (catmull-rom as per scale up) should give better results. It may be necessary to decide a policy for reductions greater than 4:1 to avoid ignoring some data points.

After that linear may benefit from a weighted mean rather than just lumping all the source pixels together. This may reduce the softening currently seen.

Currently pretending to do cubic and just averaging is not too good.

/gg

g4@catking.net
2007-06-10 08:31:04 UTC (over 17 years ago)

improving image scale: reduction

On Sun, 10 Jun 2007 05:53:57 +0200, wrote:

I think cubic (catmull-rom as per scale up) should give better results. It
may be necessary to decide a policy for reductions greater than 4:1 to avoid ignoring some data points.

As I suspected the catmull-rom spline works better than the existing code on small reductions (tested at 65%). At larger reductions it introduced some intrusive colour distortions so the existing pixel averaging code produced better results in this case.

I think "cubic" interpolation probably should be changed to actually do cubic and let the user find out where it is better or worse.

There is also a slight lack of clarity in calling what the code does now "linear". Averaging colours over 4.35 pixels , for example, cannot be described as linear interpolation!

Maybe the name "linear" should be changed to better reflect what the code does. Perhaps "pixel mean" or "average".

This would accurately reflect what the code does in both directions since linear scale up does not actually do a linear interpolation anyway (ie fit a first order polynomial), it does a mean which gives the same result.

It does not sound a good since we're all so used to linear but it is understandable to just about anyone and does accurately describe what the code does in both cases.

Any other suggestions?

gg

Sven Neumann
2007-06-10 13:12:02 UTC (over 17 years ago)

improving image scale: reduction

Hi,

On Sun, 2007-06-10 at 05:53 +0200, g4@catking.net wrote:

in result of some comments in #166130 I have been looking at image scaling in scale-funcs.c

It seems the needs of scale down are quite different from the interpolation of scaling up so there are certain compromises in using the same lin/cubic/lanczos list of options.

It would be very nice if you could work on this and prepare a detailed analysis. But we will not look at this before the 2.4 release. Fiddling with this bears too much risk of introducing more bugs. Or do you think that there's need for immidiate action?

For GIMP 2.6, we will need high-quality and optimised scaling algorithms implemented as GEGL operators. Perhaps it would be a good idea to write such operators now so that we can start to use them when we port the core to GEGL.

Sven

Mark Lowry
2007-06-10 14:24:20 UTC (over 17 years ago)

improving image scale: reduction

--- g4@catking.net wrote:

On Sun, 10 Jun 2007 05:53:57 +0200, wrote:

There is also a slight lack of clarity in calling what the code does now
"linear". Averaging colours over 4.35 pixels , for example, cannot be
described as linear interpolation!

Maybe the name "linear" should be changed to better reflect what the code
does. Perhaps "pixel mean" or "average".

This would accurately reflect what the code does in both directions since
linear scale up does not actually do a linear interpolation anyway (ie fit
a first order polynomial), it does a mean which gives the same result.

It does not sound a good since we're all so used to linear but it is
understandable to just about anyone and does accurately describe what the
code does in both cases.

Any other suggestions?

gg

g4@catking.net
2007-06-10 14:42:04 UTC (over 17 years ago)

improving image scale: reduction

On Sun, 10 Jun 2007 13:12:02 +0200, Sven Neumann wrote:

Hi,

On Sun, 2007-06-10 at 05:53 +0200, g4@catking.net wrote:

in result of some comments in #166130 I have been looking at image scaling
in scale-funcs.c

It seems the needs of scale down are quite different from the interpolation of scaling up so there are certain compromises in using the
same lin/cubic/lanczos list of options.

It would be very nice if you could work on this and prepare a detailed analysis. But we will not look at this before the 2.4 release. Fiddling with this bears too much risk of introducing more bugs. Or do you think that there's need for immidiate action?

Not "cubic":
Well the scaling down is pretty sub-standard right now on all fronts. Pretending to have linear and cubic where in fact it does neither seems pretty poor, I would have thought that warranted a change before 2.4 . The spline code produces clearly better results from 1:1 down to 1:2 at least where averaging is weak and this must be a very common range for scaling.

I do take your point about the danger of introducing bugs but it was pretty trivial to add catmull-rom. I did it in an almost identical fashion that scaling up does it. Much to my amazement it ran first time!

I need to check out that borders handle overflow the same way before submitting but it seems to.

Lanczos downscaling:

I'm hoping to get some more detail from Yuu. As you know I've had some doubt about Lanczos on reduction since it went in. A nagging doubt that something theoretical is wrong. I think the cutoff frequency is wrong. Having said that it gives reasonably good results and IMO is stable for release.

Again the base code has had a fair test period now and the required changes should not be fundamental change.

I'm trying to avoid flooding bugzilla with the discussion but Yuu does not seem to want for get on this list just now.

I'm not too convinced about the patch he's submitted yet but he seems to have a good degree on knowlege on sample theory so hopefully we will come together pretty quickly on this.

For GIMP 2.6, we will need high-quality and optimised scaling algorithms implemented as GEGL operators. Perhaps it would be a good idea to write such operators now so that we can start to use them when we port the core to GEGL.

Doubtful. I can find a bit of time to tweek in the existing code but 2.6 seems a very long way off just now and I really dont have the time to get deeply into geggling.

A bit nearer the time maybe.

gg/

g4@catking.net
2007-06-10 18:31:32 UTC (over 17 years ago)

improving image scale: reduction

On Sun, 10 Jun 2007 14:24:20 +0200, Mark Lowry wrote:

Actually, I think the best naming method for the end user would be based on speed and quality (fastest, best, etc.)

thanks for the post.

I know what you mean but "fast and a bit grainy better on small reduction ratios" does not work and "fast" without any further comment is about as much help as "good" , "best" etc. It's too subjective to be able to say this sort of thing.

Sure it would good for the user if the life of DSP was that simple, sadly it ain't.

Also Gimp is not aiming at a click and "share" audience. Let's try to imagine that some of the user-base probably know a lot more about the subject than we do and treat them with a bit of respect.

Anyone who has no idea what linear means will, like you say, suck and see. Everyone else has the right to some indication as to what method they are selecting. Hell, they may even know what they are doing!

It seems there was some discussion in 2005 about decimation but it was rather inconclusive.

Clearly "linear"="cubic" is nonsense, both analitically and UI wise. The options should do something different. Looking a bit closer, reduction seems to require some top-down design before coding takes place.

1/ It seems that "linear" aka average should be wieghted rather than just the mean it seems to do now.
2/ Is cubic a valid reduction method. It seems to provide better results than decimation near to 1:1 , does decimation need a wider window or is cubic good here?
3/ Can the different needs of interpolation and decimation be represented by the same interface? (Same drop down list.) 4/ I leave lanczos out of this for the moment because I think Yuu's contribution will finally provide the missing link on L3 reduction. I expect it be the most consistant of the current options, working in both directions.

gg/

Sven Neumann
2007-06-10 23:41:01 UTC (over 17 years ago)

improving image scale: reduction

Hi,

On Sun, 2007-06-10 at 14:42 +0200, g4@catking.net wrote:

For GIMP 2.6, we will need high-quality and optimised scaling algorithms implemented as GEGL operators. Perhaps it would be a good idea to write such operators now so that we can start to use them when we port the core to GEGL.

Doubtful. I can find a bit of time to tweek in the existing code but 2.6 seems a very long way off just now and I really dont have the time to get deeply into geggling.

We are about to release GIMP 2.4 and as soon as that has happened we will start to port things to GEGL. So working on GEGL now is the best thing you can do. Patches for the GIMP scaling routines are most likely not going to be accepted before 2.4. And after 2.4 we are going to throw out this code anyway.

Sven

g4@catking.net
2007-06-11 12:16:04 UTC (over 17 years ago)

improving image scale: reduction

On Sun, 10 Jun 2007 23:41:01 +0200, Sven Neumann wrote:

Hi,

On Sun, 2007-06-10 at 14:42 +0200, g4@catking.net wrote:

For GIMP 2.6, we will need high-quality and optimised scaling

algorithms

implemented as GEGL operators. Perhaps it would be a good idea to

write

such operators now so that we can start to use them when we port the core to GEGL.

Doubtful. I can find a bit of time to tweek in the existing code but 2.6 seems a very long way off just now and I really dont have the time to get
deeply into geggling.

We are about to release GIMP 2.4 and as soon as that has happened we will start to port things to GEGL. So working on GEGL now is the best thing you can do. Patches for the GIMP scaling routines are most likely not going to be accepted before 2.4. And after 2.4 we are going to throw out this code anyway.

Sven

OK, thanks for saving me wasting my time. ;)

This discussion about decimation<>interpolation needs to be picked up again once 2.4 is out.

I'll still see if I can finalise the lanczos code for downscaling since that routine will need importing into GEGL and it should at least be theoretically valid.

gg/

Guillermo Espertino
2007-06-11 18:04:52 UTC (over 17 years ago)

improving image scale: reduction

From the user perspective, the downscaling quality is very important. More if you consider using GIMP for web graphics production, where downscaling is one of the most frequent operations. It would be nice if this problem is addressed before 2.4 I understand the stability risk being so close to the release of the 2.4 version, but if someone has an improvement in this field and can be added, it well be welcome.
I wouldn't say it's a critic item, but the current algorithms are right now quite sub-standard.

Gez.

Sven Neumann
2007-06-11 19:34:56 UTC (over 17 years ago)

improving image scale: reduction

Hi,

On Mon, 2007-06-11 at 13:04 -0300, Guillermo Espertino wrote:

I wouldn't say it's a critic item, but the current algorithms are right now quite sub-standard.

I might be wrong but I think the current algorithms are basically the same as the ones used in GIMP 2.2. So there's really no point in addressing this long-standing but minor issue before 2.4.

Sven

Guillermo Espertino
2007-06-12 14:25:01 UTC (over 17 years ago)

Gimp-developer Digest, Vol 57, Issue 11

Hi,

I'm writing and testing the new ICC profile selection dialog box. Separate+ includes this dialog since 20070610 release.

Please try it, and tell me any ideas.

Separate+ plug-in is available at: http://cue.yellowmagic.info/softwares/separate.htm

Wow! This is so interesting! Is there any chance to see this plugin and the Save for web plugin in Gimp 2.4 as part of the default installation? The separate+ plugin would be a great help for those who need CMYK until de GEGL integration.

Gez

Kevin Cozens
2007-06-12 19:11:40 UTC (over 17 years ago)

Separate+ plug-in

Guillermo Espertino wrote:

Separate+ plug-in is available at: http://cue.yellowmagic.info/softwares/separate.htm

The server is either down or the URL is bad. I can't access the referenced web page. I just get a 404 error.

Aurimas Juška
2007-06-12 19:29:34 UTC (over 17 years ago)

Separate+ plug-in

Paste the last l :)
http://cue.yellowmagic.info/softwares/separate.html

On 6/12/07, Kevin Cozens wrote:

Guillermo Espertino wrote:

Separate+ plug-in is available at: http://cue.yellowmagic.info/softwares/separate.htm

The server is either down or the URL is bad. I can't access the referenced web page. I just get a 404 error.

-- Cheers!

Kevin.

http://www.ve3syb.ca/ |"What are we going to do today, Borg?" Owner of Elecraft K2 #2172 |"Same thing we always do, Pinkutus: | Try to assimilate the world!" #include | -Pinkutus & the Borg

Øyvind Kolås
2007-06-12 22:12:20 UTC (over 17 years ago)

Gimp-developer Digest, Vol 57, Issue 11

On 6/12/07, Guillermo Espertino wrote:

The separate+ plugin would be a great help for those who need CMYK until de GEGL integration.

The GEGL integration will not immediately provide native CMYK support. The kind of CMYK supported provided by the separate+ plug-in is the form of CMYK support that most probably will be natural to implement with GEGL initially as well, and for most work flows this will be sufficient. At some point internal CMYK processing might be added to GEGL, but other internal optimizations and architectural changes will have to be done first.

/Øyvind K.