Re: [Gimp-user] Help with script
Quoting none : > Oh, ok. Thanks for clearing that up. > What about my other question, outputting a comma to the file? You need to use 'display' instead of 'write', and output the offsets individually (or construct a string using 'string-append'; 'display' only accepts one object at a time). (if (= (car bounds) 0) (display "0,0" p) (begin (begin (display (- (cadr bounds) x) p) (display "," p) (display (- (cadddr bounds) x) p) ) ) ) More information about handling Scheme's I/O is available at: http://www.schemers.org/Documents/Standards/R5RS/HTML ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Help with script
Quoting none : > Sorry, i got another question. I want to find the width of each character by > essentially "cropping" the cell. But this bit of code in the script saulgoode > gave me: > > (gimp-rect-select image x y width height ...) > (set! bounds (gimp-selection-bounds image)) > > just seems to get the width and height of the selection, which is obviously > known since it's used to set the selection in the first place! Since the operation mode of 'gimp-rect-select' is CHANNEL-OP-INTERSECT, the resulting selection is only the non-transparent part of all chars that lie within the region of that cell (i.e., the non-transparent part of a single char). This is the opposite order of what you may have been expecting -- that is, to select a cell and THEN select the non-transparent part of the cell -- but the net result is the same! It was simpler to do it my way because the "Alpha To Selection" function ('gimp-selection-layer-alpha') does not allow for CHANNEL-OP modes. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Help with script
The comma isn't the problem; there's nothing special about commas in Scheme strings. It's the output function you're using - (write) formats things in Scheme source-code form so they can be (eval)'ed when read back in. To just output some text as text, use (display) instead. For a single comma you could also use (write-char #\,). On 1/15/09, none wrote: > Hi again. I just have one question about the script. Well it's more about > Scheme in general but i couldn't find the answer in any tutorials (i was > probably just looking in the wrong place). Anyway, i want to write a comma > to > the file but (write "," file) writes the comma with the quotes included. And > using a character #\, doesn't work either. Is there a special escape code > for > printing commas or what? > thanks > > -- > none > ___ > Gimp-user mailing list > Gimp-user@lists.XCF.Berkeley.EDU > https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user > -- Sent from Gmail for mobile | mobile.google.com Mark J. Reed ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] Help with script
http://flashingtwelve.brickfilms.com/GIMP/Scripts/sg-char-process.scm Quoting XTAL256 : > Hi all, > I am making a 2D game and i am currently working on variable-width bitmap > fonts to use in the game. I have already written code to load an image > containing the characters and display text on screen in the chosen > font but up > until now i have just set the width of each character to be all the same > (fixed-width). > > Now i have modified it so that it reads in a list of numbers from a file and > sets each character's width to the respective number in the list. > > All of that works but i now need a way of getting those numbers so i thought > someone might help me make a GIMP script that can do it. Basically, i have an > image which contains the characters on a 16x8 grid. I will need to find the > first line on the x axis which does not contain all transparent > pixels and the > last line, relative to the current cell (and will loop through all cells). > Then i can calculate the width as last-first. I also need to display/print > these widths as text so that i can easily copy/paste to a text file. > > Any help would be appreciated (and i would *really* appreciated it if someone > could do it for me :).) > Oh, and i am using GIMP 2.6 on WinXP. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user