It is currently Sun Sep 27, 2026 10:58 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 32 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: value invert
PostPosted: Tue Apr 14, 2015 5:49 am  (#21) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14835
Location: roma, italy
maybe the error has something to do with bug#564697 even if it happens both using an image with alpha and without an alpha channel
(the error says: Error scanning 'decompose-data' parasite: too few layers found)

or -maybe- with bug#626944

_________________
"Where am I ?"


Top
 Post subject: Re: value invert
PostPosted: Tue Apr 14, 2015 8:49 am  (#22) 
Offline
Script Coder
User avatar

Joined: Dec 27, 2014
Posts: 508
Looks like you've found a bug, Dinasset.

The problem is actually in the decompose plugin, not recompose.
The decompose plugin attaches a Gimp "parasite" (ie. a data block containing text information) to the decomposed image, bearing the information necessary for recompose to do the re-composing automatically.
Unfortunately, the "compose_type" strings for the YCbCr *256 modes have been mis-specified in the definition table, without underscores between the various parts of the name ("YCbCr ITU R470 256" instead of "YCbCr_ITU_R470_256"):
  { "YCbCr_ITU_R470",     TRUE, 3, { N_("luma-y470"),
                                     N_("blueness-cb470"),
                                     N_("redness-cr470") }, extract_ycbcr470 },

  { "YCbCr_ITU_R709",     TRUE, 3, { N_("luma-y709"),
                                     N_("blueness-cb709"),
                                     N_("redness-cr709") }, extract_ycbcr709 },

  { "YCbCr ITU R470 256", TRUE, 3, { N_("luma-y470f"),
                                     N_("blueness-cb470f"),
                                     N_("redness-cr470f") }, extract_ycbcr470f },

  { "YCbCr ITU R709 256", TRUE, 3, { N_("luma-y709f"),
                                     N_("blueness-cb709f"),
                                     N_("redness-cr709f") }, extract_ycbcr709f }
and so the recompose plugin gets confused when it tries to interpret the parasite.

You can see the difference on the Script-Fu Console:
> (gimp-image-list)
(2 #(7 1))
> (gimp-image-get-parasite 7 "decompose-data")
(("decompose-data" 0 "source=2 type=YCbCr_ITU_R470 22 23 24 "))
> (gimp-image-list)
(3 #(8 7 1))
> (gimp-image-get-parasite 8 "decompose-data")
(("decompose-data" 0 "source=2 type=YCbCr ITU R470 256 26 27 28 "))

If you are writing a script to do your inverting, you could (in theory) actually "mend" the parasite from your script (eg. change "YCbCr ITU R470 256" to "YCbCr_ITU_R470_256").


Top
 Post subject: Re: value invert
PostPosted: Tue Apr 14, 2015 9:18 am  (#23) 
Offline
Script Coder
User avatar

Joined: Dec 27, 2014
Posts: 508
Reported as a bug:
https://bugzilla.gnome.org/show_bug.cgi?id=747853


Top
 Post subject: Re: value invert
PostPosted: Tue Apr 14, 2015 9:24 am  (#24) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14835
Location: roma, italy
thanks Jonathan for reporting the bug to bugzilla
in my script I call(ed) already the "decompose" using the type-name with the underscore
so, what I should have done is to amend the parasite created by the "decompose" before calling the "recompose", but I do not know how to do it
maybe at the moment I do not use the *_256 types (only the two w/o that suffix)

_________________
"Where am I ?"


Top
 Post subject: Re: value invert
PostPosted: Tue Apr 14, 2015 9:38 am  (#25) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14835
Location: roma, italy
BTW Jonathan, by googling (but I didn't store the link) I read that the parasite creation by the decompose plug-in has been added to the original source by the author of the recompose plug-in, which sounds strange...

_________________
"Where am I ?"


Top
 Post subject: Re: value invert
PostPosted: Tue Apr 14, 2015 12:32 pm  (#26) 
Offline
Script Coder
User avatar

Joined: Dec 27, 2014
Posts: 508
@Dinasset
To "mend" the parasite you could try this code:

(let*
  (
    (str (caddar (gimp-image-get-parasite image "decompose-data"))) ; get the parasite user-string
    (i 0)
  )
  (while (not (char=? (string-ref str i) #\space)) (set! i (+ i 1)))   ;find first space
  (when (string=? (substring str i (+ i 12)) " type=YCbCr ")      ;if its a bad type name (ie. YCbCr followed by a space)..
    (string-set! str (+ i 11) #\_)               ;..replace the spaces with underscores
    (string-set! str (+ i 15) #\_)
    (string-set! str (+ i 20) #\_)
    (gimp-image-detach-parasite image "decompose-data")            ;..remove the existing parasite
    (gimp-image-attach-parasite image (list* "decompose-data" 0 str ()))   ;..and attach the amended version
  )
)

This is a pretty horrible workaround but it seems to do the job.
You'll need to test it thoroughly.


Top
 Post subject: Re: value invert
PostPosted: Tue Apr 14, 2015 1:47 pm  (#27) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14835
Location: roma, italy
jontait2 wrote:
@Dinasset
To "mend" the parasite you could try this code:

(let*
  (
    (str (caddar (gimp-image-get-parasite image "decompose-data"))) ; get the parasite user-string
    (i 0)
  )
  (while (not (char=? (string-ref str i) #\space)) (set! i (+ i 1)))   ;find first space
  (when (string=? (substring str i (+ i 12)) " type=YCbCr ")      ;if its a bad type name (ie. YCbCr followed by a space)..
    (string-set! str (+ i 11) #\_)               ;..replace the spaces with underscores
    (string-set! str (+ i 15) #\_)
    (string-set! str (+ i 20) #\_)
    (gimp-image-detach-parasite image "decompose-data")            ;..remove the existing parasite
    (gimp-image-attach-parasite image (list* "decompose-data" 0 str ()))   ;..and attach the amended version
  )
)

This is a pretty horrible workaround but it seems to do the job.
You'll need to test it thoroughly.


Thanks a lot, Jonathan!
Added your code.
To let it do its work in my script (which is an adaptation of the original script luma-invert) I did the following (obvious) modifications:
1-name of the image ==> temp-image
2-name of the types suffixed by 256 ==> restored to their original text with blanks instead of underscores

SUCCESS ! ! !

now all the 4 types execute their work, the 2 w/o the suffix (which were always working OK) and the 2 with the suffix 256

I post here the results:

original image:
Attachment:
originali 721.jpg
originali 721.jpg [ 577.24 KiB | Viewed 2978 times ]


the 4 different outcomes

Attachment:
originali 721_YCC_LumaInvert-470.jpg
originali 721_YCC_LumaInvert-470.jpg [ 582.17 KiB | Viewed 2978 times ]

Attachment:
originali 721_YCC_LumaInvert-470-256.jpg
originali 721_YCC_LumaInvert-470-256.jpg [ 586.67 KiB | Viewed 2978 times ]


(....)

_________________
"Where am I ?"


Top
 Post subject: Re: value invert
PostPosted: Tue Apr 14, 2015 1:49 pm  (#28) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14835
Location: roma, italy
(...)

Attachment:
originali 721_YCC_LumaInvert-709.jpg
originali 721_YCC_LumaInvert-709.jpg [ 583.43 KiB | Viewed 2978 times ]

Attachment:
originali 721_YCC_LumaInvert-709-256.jpg
originali 721_YCC_LumaInvert-709-256.jpg [ 588.78 KiB | Viewed 2978 times ]


Thanks ! ! !

_________________
"Where am I ?"


Top
 Post subject: Re: value invert
PostPosted: Tue Apr 14, 2015 1:50 pm  (#29) 
Offline
Script Coder
User avatar

Joined: Dec 27, 2014
Posts: 508
Good stuff Dinasset.

Bug update:
[email protected] is treating this bug as a duplicate of the previous bug#564697 (which apparently was caused by the same problem) and is using our findings to correct master.


Top
 Post subject: Re: value invert
PostPosted: Tue Apr 14, 2015 1:53 pm  (#30) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14835
Location: roma, italy
OK!

_________________
"Where am I ?"


Top
 Post subject: Re: value invert
PostPosted: Tue Apr 14, 2015 2:20 pm  (#31) 
Offline
Script Coder
User avatar

Joined: Dec 27, 2014
Posts: 508
10:58 this morning (London time)
dinasset wrote:
it seems that the plug-in "recompose" does not work when in the "decompose" phase it has been selected one of the two YCC options suffixed 256

20:08 this evening (London time)
Quote:
Michael Natterer [GIMP developer] 2015-04-14 18:13:43 UTC

Fixed in gimp-2-8, in master, the bug was fixed by a refactoring.

commit df7969c08d531c1c310c85d132b30321e838a47e
Author: Michael Natterer <[email protected]>
Date: Tue Apr 14 20:08:17 2015 +0200

Bug 564697 - Recomposing 'YCbCrITU R470 256' and 'YCbCrITU R709 256'...

...causes 'Error scanning 'decompose-data' parasite: too few layers found'

Fix the identifier strings of the color models to have underscores
instead of spaces. Found by Jonathan Tait.

plug-ins/common/decompose.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

In other words, bug detected, identified, reported, fixed in master and resolved in just over 9 hours.
That must be some sort of record!


Top
 Post subject: Re: value invert
PostPosted: Tue Apr 14, 2015 4:41 pm  (#32) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
jontait2 wrote:
In other words, bug detected, identified, reported, fixed in master and resolved in just over 9 hours.
That must be some sort of record!

A couple of times bugs I've reported were fixed in under an hour. I was particularly impressed by the rapid response to this one, but it took me longer than that to report it. (Another bug was fixed in less time, but was just a trivial change to a menu command).

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
Post new topic Reply to topic  [ 32 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group