Re: [Gimp-developer] Invalid input arguments of file-raw-save2

2020-02-27 Thread Ofnuts

Looking at the source code; RAW_PLANAR would be 6 (the plugin defines
many images types, but only accepts RAW_RBG and RAW_PLANAR when saving).



___
gimp-developer-list mailing list
List address:gimp-developer-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list


[Gimp-developer] Invalid input arguments of file-raw-save2

2020-02-27 Thread longquan_135--- via gimp-developer-list
I'm trying to write my own scripts to save a selection to a RAW file with GIMP 
script-fu.
I found that the argument "image-type" in "file-raw-save2" expects values from 
{ RAW_RGB (0), RAW_PLANAR (3) }. When using 3 for this argument, I got the 
following result:
Error: Procedure execution of file-raw-save2 failed on invalid input 
arguments.
However 0 is OK for "image-type" and the image is saved successfully.
Does anyone know how to fix this?

Here is some information about my system:
GIMP version: 2.10.14
Operating System: Windows 10 professional v1809

Reproduction
1. Save following content as a .scm file in gimp’s script folder. (The 
mentioned file-raw-save2 function is in line 89.)
--
(define (split-path path)
(let*
(
(ret '())
)
(for-each
(lambda (part)
(set! ret (append ret (strbreakup part 
DIR-SEPARATOR)))
)
(strbreakup path DIR-SEPARATOR)
)
ret
)
)


(define (script-fu-compose-file-name inImage
inRowIndex
inColumnIndex
inWidth
inHeight)
(let*
(
(fileName "")
(filePath (car (gimp-image-get-filename inImage)))
(fileDir (unbreakupstr (butlast (split-path filePath)) 
DIR-SEPARATOR))
)
(set! fileName
(string-append
fileDir
DIR-SEPARATOR
(number->string inRowIndex)
"_"
(number->string inColumnIndex)
"_"
(number->string inWidth)
"_"
(number->string inHeight)
".xcf"
)
)
fileName
)
)

(define (script-fu-save-selection inImage
inDrawable
inRowIndex
inColumnIndex
inX
inY
inChunkLength
inImageWidth
inImageHeight)
(let*
(
(theWidth 0)
(theWitdhExpected 0)
(theHeight 0)
(theHeightExpected 0)
(theRAWDefaults (file-raw-get-defaults))
)
(file-raw-set-defaults 3 0)
(set! theWitdhExpected (- (+ inX inChunkLength) 1))
(if (<= theWitdhExpected inImageWidth)
(set! theWidth inChunkLength)
(set! theWidth (- inImageWidth inX))
)

(set! theHeightExpected (- (+ inY inChunkLength) 1))
(if (<= theHeightExpected inImageHeight)
(set! theHeight inChunkLength)
(set! theHeight (- inImageHeight inY))
)
(gimp-image-select-rectangle inImage CHANNEL-OP-REPLACE inX inY 
theWidth theHeight)
(gimp-edit-copy inDrawable)
(let*
(
(theFileName (script-fu-compose-file-name inImage inRowIndex 
inColumnIndex theWidth theHeight))
(theNewImage (car (gimp-edit-paste-as-new-image)))
(theNewDrawable 0)
)
(set! theNewDrawable (car (gimp-image-get-active-drawable 
theNewImage)))
;(gimp-file-save RUN-NONINTERACTIVE
;theNewImage
;theNewDrawable
;theFileName
;theFileName)
(file-raw-save2 RUN-NONINTERACTIVE
theNewImage
theNewDrawable
theFileName
theFileName
3
0)
(gimp-image-delete theNewImage)
)
(file-raw-set-defaults (car theRAWDefaults) (cadr theRAWDefaults))
)
)

(define (script-fu-split-image inImage
inDrawable
inXPos
inYPos
inChunkLength
)
(let*
(
(theRowCount 0)
(theColumnCount 0)
(theImageWidth 0)
(theImageHeight 0)
(theRowIndex 0)
(theColumnIndex 0)
(theX 0)
(theY 0)
)
(set! theImageWidth (car (gimp-image-width inImage)))
(set! theImageHeight (car (gimp-image-height inImage)))
(set! theRowCount (/ theImageHeight (- inChunkLength 1)))
(set! theColumnCount (/ theImageWidth (- inChunkLength 1)))
(while (<= theRowIndex theRowCount)
(set! theY (+ (* theRowIndex (- inChunkLength 1)) inYPos))
  

Re: [Gimp-developer] [ANN] gimpgitbuild 0.2.1 - a commandline tool to build GIMP and its dependencies from their git repos

2020-02-27 Thread Shlomi Fish
Hi Owen and all,

On Thu, 27 Feb 2020 00:59:39 +0100
Owen  wrote:

> > Hi all!
> >
> > See:
> >
> > https://metacpan.org/release/App-gimpgitbuild
> >
> > You can do either:
> >
> > gimpgitbuild build
> >
> > Or:
> >
> > gimpgitbuild env
> >
> > Hope you find it useful and contributions / comments are welcome at
> > https://github.com/shlomif/App-gimpgitbuild , here on the list, or in
> > private.  
> 
> 
> Hi,
> 
> All the modules installed ok, but running failed after downloading  babl
> 
> ...
> Running [cd "/home/owen/Download/unpack/graphics/gimp/babl/git/babl" && git
> checkout "master" && (false || git s origin "master") && mkdir -p "build" &&
> cd build && meson --prefix="/home/owen/apps/graphics/babl" .. && ninja -j4 &&
> ninja -j4 test && ninja -j4 install] Already on 'master' Your branch is up to
> date with 'origin/master'. git: 's' is not a git command. See 'git --help'.
> 

This should be fixed in version 0.6.0:

https://metacpan.org/pod/App::gimpgitbuild

Thanks for the report, and if possible, please try again and let me know if it
is now working for you.

> Grepping for "git" in gimpgitbuild did not find a git command with the 's'
> option (found no git commands at all)
> 
> Is this a bug?
> 
> 
> Owen
> 
> 



-- 

Shlomi Fish   https://www.shlomifish.org/
Free (Creative Commons) Music Downloads, Reviews and more - http://jamendo.com/

When you say “I wrote a program that crashed Windows”, people just stare at
you blankly and say “Hey, I got those with the system, *for free*”.
— https://en.wikiquote.org/wiki/Linus_Torvalds

Please reply to list if it's a mailing list post - http://shlom.in/reply .
___
gimp-developer-list mailing list
List address:gimp-developer-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list


Re: [Gimp-developer] [ANN] gimpgitbuild 0.2.1 - a commandline tool to build GIMP and its dependencies from their git repos

2020-02-27 Thread Shlomi Fish
Hi Owen,

thanks for your problem report, and for trying gimpgitbuild.

On Thu, 27 Feb 2020 00:59:39 +0100
Owen  wrote:

> > Hi all!
> >
> > See:
> >
> > https://metacpan.org/release/App-gimpgitbuild
> >
> > You can do either:
> >
> > gimpgitbuild build
> >
> > Or:
> >
> > gimpgitbuild env
> >
> > Hope you find it useful and contributions / comments are welcome at
> > https://github.com/shlomif/App-gimpgitbuild , here on the list, or in
> > private.  
> 
> 
> Hi,
> 
> All the modules installed ok, but running failed after downloading  babl
> 
> ...
> Running [cd "/home/owen/Download/unpack/graphics/gimp/babl/git/babl" && git
> checkout "master" && (false || git s origin "master") && mkdir -p "build" &&
> cd build && meson --prefix="/home/owen/apps/graphics/babl" .. && ninja -j4 &&
> ninja -j4 test && ninja -j4 install] Already on 'master' Your branch is up to
> date with 'origin/master'.
>
> git: 's' is not a git command. See 'git --help'.
> 
> Grepping for "git" in gimpgitbuild did not find a git command with the 's'
> option (found no git commands at all)
> 
> Is this a bug?
>

Kind of - I assumed my "git-s" program is in the path, see:

https://github.com/shlomif/shlomif-computer-settings/blob/master/shlomif-settings/home-bin-executables/bin/git-s
 
Naturally, it is not a right assumption and so I'll have to fix it in the
upcoming, new, release.

Thanks!

> 
> Owen
> 
> 



-- 

Shlomi Fish   https://www.shlomifish.org/
https://github.com/shlomif/Freenode-programming-channel-FAQ

 * rindolf demands equal rights for years, minutes, hours and days to also get
   YAAKOV’S GREAT HUGE LOVE.
—  http://www.shlomifish.org/humour/fortunes/sharp-perl.html

Please reply to list if it's a mailing list post - http://shlom.in/reply .
___
gimp-developer-list mailing list
List address:gimp-developer-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list