Print Page | Close Window

DB ToolBox - Grafx2 scripts UPDATED dec13

Printed From: Pixel Joint
Category: The Lounge
Forum Name: Resources and Support
Forum Discription: Help your fellow pixel artists out with links to good tutorials, other forums, software, fonts, etc. Bugs and support issues should go here as well.
URL: https://pixeljoint.com/forum/forum_posts.asp?TID=12854
Printed Date: 10 September 2025 at 10:53am


Topic: DB ToolBox - Grafx2 scripts UPDATED dec13
Posted By: DawnBringer
Subject: DB ToolBox - Grafx2 scripts UPDATED dec13
Date Posted: 30 August 2011 at 8:14pm
!!! UPDATE 2018 !!!

The new 1.4 version of the ToolBox is available here http://pixeljoint.com/forum/forum_posts.asp?TID=26080 - GrafX2 ToolBox v1.4



--------------------------------------------------

UPDATE! TOOLBOX v1.3 http://goto.glocalnet.net/axe/toolbox13.zip - zip-archive
Ten new scripts, f.ex one that allows you to design geometric shapes as aid for your sprites and art. Added Dennis' winning palette to the custom presets.



Documentation updated with many pictures (also included in the zip-archive), here's the online version: http://goto.glocalnet.net/axe/dtb12/index.html - ToolBox v1.3 documentation

http://goto.glocalnet.net/axe/toolbox13.zip - zip-archive

(13 Dec 2011).
--

Right, so here's the story... there's a nice little pixelprogram called Grafx2 and in the recent years we have greatly developed its scripting ability (well, I request features and others implement ;))


Now I have written about 100 more or less useful scripts for different Color, Brush, Palette & Image operations. Luckily Grafx2-scripting allows for a simple window/menu system...so all the scripts can be launched from a single mainscript - The ToolBox, and this can be assigned to a key if desired. And you're welcome to try & use them if you like!

Here's a http://goto.glocalnet.net/axe/toolbox13.zip - zip-archive with the scripts and some instructions. Note that you may need a recent version of Grafx2 for all scripts to work (there's links in the instructions). Some scripts/algorithms are still WIP/Experimental...but that shouldn't stop you from having some fun.

Some of the stuff you can find in there:

* MANY Palette analysis & optimation tools
* 3D-palette viewer
* AA-color finders
* Brightness/Hue/Contrast/Balance/Saturation/Lightness adjustment for Palette, Brush or Color (top quality)
* Tint/Colorize (Image & Brush)
* RetroFormat remapping
* C64-format testing
* Brush-2-Image, Image-2-Brush, Crop Brush Margins
* Curved Color Ramps (wip)
* Image effects & filters
* Palette/Histogram/Mixcolortable to Brush
* RubThru Pencolor (Spare 2 Main)
* TileSheet reorganizer
and much, much more...

If you have any problems just let me know.

I'd love to see more people try some Grafx2 Lua-scripting!

http://code.google.com/p/grafx2/ - Grafx2 Homepage
And here's the page with scripting information: http://code.google.com/p/grafx2/wiki/BrushFactory - Brush Factory



Replies:
Posted By: ChrisButton
Date Posted: 31 August 2011 at 7:15am
Thank you! :-D


Posted By: vulthoom
Date Posted: 31 August 2011 at 11:26am
Thaank you! =]
I swear, i'll try to make some lua, and i post here.

After much time, u 3d palette viwer is AWESOME *-*


Posted By: iLKke
Date Posted: 05 September 2011 at 4:40am
Thanks for the awesome script, man!
Also, thanks for letting me betatest the c64 script :D


Posted By: jalonso
Date Posted: 06 September 2011 at 6:04pm
Do these scripts work on the Mac version?
How does a non-geek add them?

*The zip version link is not extracting on my Mac so I can't see what these directions are.


-------------
http://www.pixeljoint.com/forum/forum_posts.asp?TID=9378&FID=6&PR=3 - PJs FAQ <•> http://www.pixeljoint.com/forum/forum_topics.asp?FID=6 - Sticky Reads


Posted By: DawnBringer
Date Posted: 06 September 2011 at 8:47pm
Hm, the Mac-version of Grafx2 has been a long running problem, but I think the 2.3 version released in May should be ok!? If you have that one and it's working you should be able to run most Lua-scripts.

Note however that new scripting features are frequently added and it's usually only the windows-version of Grafx2 that is released as betas. Some of my scripts use newer instructions that probably don't work with 6 month old versions of the program...but most scripts should still function fine I hope.

I only included a link to the latest windows-beta in the readme.txt, you should find a Mac version here:

http://code.google.com/p/grafx2/wiki/Downloads?tm=2 - Downloads

Instruction how to install (just some moving/copying) the scripts are also in the readme.txt. The directory-structure is a bit different on Mac, zip-archive has been updated with new instructions.




Posted By: yrizoud
Date Posted: 07 September 2011 at 6:57am
DawnBringer: I think your scripts will only work if the libraries are in scripts/libs, because the command "require" doesn't precise where the libraries can be found. There's a problem with some of your scripts that require("memory"), because this one is not in your zip, and in a 2.3 package it's in scripts/samples_2.3/libs/

(The sample scripts of 2.3 use dofile() which supports directories, whereas require() doesn't : dofile("../libs/dawnbringer_lib.lua")

The difference between OSX and Linux/Windows is that the scripts directory is the directory Contents\Resources\scripts\ in the bundle, instead of (where_you_installed_it)/share/grafx2/scripts/.
Other than that, it should behave similarly.


Posted By: Mrmo Tarius
Date Posted: 07 September 2011 at 9:58am
I need to try these out right away. Thanks for making and sharing this!


Posted By: DawnBringer
Date Posted: 07 September 2011 at 5:05pm
Oh yeah, I almost forgot about that recent change with "samples", I'm just using the old system with the root "libs"-dir. Figure I'll update the scripts some day with "dofile" so everything can fit in one drawer...but you know 100 scripts, phew! Thanx for the OSX info, I feared it would be different.

Anyways, I updated the zip-archive with the recent installation-info and the missing memory-lib.


Posted By: PulkoMandy
Date Posted: 10 September 2011 at 12:42am
Should be possible to update these scripts easily with some unix shell magic. I'll have a look at that :)

edit: done !
http://pulkomandy.lexinfo.fr/drop/dawnscripts_dofile.zip - http://pulkomandy.lexinfo.fr/drop/dawnscripts_dofile.zip

Trick used :

sed -e 's!require("\(.*\)")!dofile("../libs/\1.lua")!g' -i *.lua

(make a backup first, as this will replace the original files).
I hope everything is ok with the result :)


Posted By: DawnBringer
Date Posted: 10 September 2011 at 6:07am
Ok, thanx. First I was thinking it would be better to put the "libs" inside "dawn" and redo your process with new paths. But instead I could put the scripts in a sub-dir and put the toolbox-script alone in the root of "dawn"...just have to update the paths, but that's simply a textreplacement.

Like this: (your "../libs" change should work here)

[dawn]
. toolboxscript.lua
. [scripts]
. [libs]

This have to be the simplest and most userfriendly structure, right?

UPDATE: Nope, that won't work as paths are relative to the inital script (the toolbox) and not any consequentally executed script. But it will work if the toolbox script is put back in the same place/level as the other scripts.


Posted By: MyO
Date Posted: 13 September 2011 at 4:16am
Gh, now I start to think that I should have bought a smartphone. There is no way GrafX2 can be ported to J2ME, is there?


Posted By: PulkoMandy
Date Posted: 14 September 2011 at 10:47am
J2ME can't be done. Sorry :(

You can buy a GP2X / Wiz /Caanoo, I think that's currently the best way to carry GrafX2 around.


Posted By: surt
Date Posted: 14 September 2011 at 11:31pm
It could also be possible that there is a port of SDL for your dumb-phone's OS  (I believe there's one for S60 for example) which might allow you to build it natively for your phone.


-------------


Posted By: MyO
Date Posted: 15 September 2011 at 2:33am
Not a chance: my phone is Sony Ericsson Cedar -- it supports J2ME application only.
There are a few nice paint programs I know about, with some neat features like palette support, Bezier curves, transparency support and tools for making animated GIF's, but...
Oh well, perhaps this is not a huge loss. Even if GrafX2 on my cellphone doubled the amount of my pixel productivity comparing to the present, it wouldn't make much difference, for I have 0 pixel-pieces in my private gallery right now.


Posted By: yrizoud
Date Posted: 15 September 2011 at 7:41am
After a bit of search about this phone, I can't see any indication that it has a touchscreen. Grafx2 is mouse-oriented, and pretty useless on plaforms with no mouse or a *precise* stylus.



Posted By: Mrmo Tarius
Date Posted: 17 September 2011 at 12:50pm
I use a samsung galaxy s + bluetooth mouse combo for grafx2 portability :P


Posted By: mdog95
Date Posted: 26 November 2011 at 2:20pm
Annoying question:

Which script runs this palette analysis?



It's one of the only ones I really want to use, and I can't find it :P


Posted By: Pandora'sSecret
Date Posted: 26 November 2011 at 3:06pm
hmm, you have actually gotten further than I did. I don't even get to the part where i know how to open these LUa's ...

Perhaps there is a really noobfriendly guide as to how to use these things, cause I really would like to make use of the 3D palette animation..


Posted By: mdog95
Date Posted: 26 November 2011 at 3:25pm
Actually, you know what, I did everything on the readme, and the folders don't show up in Grafx. My computer originally wouldn't open the .zip folder, so I force extracted the folders, then put them where the readme said, and... only the sample folder is there. I tried restarting and all that.


Posted By: DawnBringer
Date Posted: 26 November 2011 at 5:17pm
@Pandora: Right-click the "Brush-effects / factory" button at the center-bottom menu, left of the text-tool. The 3D-Palette is bundled with Grafx2 (Samples2.4/Demo).

@mdog95: What version of Grafx2 are you running?



Posted By: mdog95
Date Posted: 26 November 2011 at 6:01pm
I just updated it to the latest today before I put the scripts in.


Posted By: DawnBringer
Date Posted: 26 November 2011 at 7:35pm
You can try the newer version available from my profile page; you should be able to place them anywhere in your system (make a dir for them first, I forgot that) and run them from there.

Assign a hot-key for ToolBox script (ex. Alt-1) for easy access.

http://goto.glocalnet.net/axe/dawntb12d.zip


Posted By: mdog95
Date Posted: 26 November 2011 at 8:35pm
It still doesn't work. Is this the latest version, or is my computer screwing me again?





The stuff just isn't showing up :/


Posted By: DawnBringer
Date Posted: 26 November 2011 at 8:44pm
Where did you put it? That's a fileselector, it shows what's there. You can navigate out of Grafx2 if needed.

Wait v2.3... get a recent 2.4WIP to make sure things work like intended:

http://grafx2.googlecode.com/files/grafx2-2.4wip1866-win32.zip


Posted By: mdog95
Date Posted: 26 November 2011 at 9:20pm
Now I have 2.4, and it's still not working. I still only get the sample_2.4. I don't know why the folders don't show up.


Posted By: DawnBringer
Date Posted: 26 November 2011 at 9:39pm
Probably coz you haven't put anything there...go into the Grafx2 dirs with a filemanager and make sure.


Posted By: mdog95
Date Posted: 26 November 2011 at 9:45pm




They're everywhere they could possibly be, and I get nothing. I hope this is what you mean by the dirs...


Posted By: DawnBringer
Date Posted: 27 November 2011 at 12:04am
Put the drawer where Grafx2 is looking for scripts, which is: grafx2\share\grafx2\scripts


Or, if you're using the +1.2 version you can place the scripts anywhere and use the brushfactory-fileselector and navigate to wherever they are located on your computer. Just make sure that my "scripts" and "libs" are present at the same level.

(Sorry if things can be a little messy, but Grafx2 is changing and improving all the time, and the script-system has changed over the last year. And I'm trying to adapt the ToolBox to work as smootly as possible...so don't give up yet! ;))


Posted By: DawnBringer
Date Posted: 13 December 2011 at 12:51pm
V1.3 released, see first post.


Posted By: yrizoud
Date Posted: 13 December 2011 at 1:11pm
I've noticed something weird in the online docs, when you click an image it zooms it, like +12.5% at a time, but after 3 times it zooms out 8 times smaller than original. A remainder of a time when each click zoomed +100% ?



Posted By: DawnBringer
Date Posted: 13 December 2011 at 1:36pm
It works fine in IE and Opera but I do notice now that it now stopped working correctly in the last version of FireFox (there you go, another reason not to use that browser anymore...I've grown so tired of all the FF crap and constant changes that I only Opera nowdays). What browser do you use?

Correct behaviour is, by each click from the original: +100%, +200%, +300%, +400%, reset to original.

I'm doing this, don't know why it fails in FF.

<script>
   for (var n=0; n<document.images.length; n++){
    document.images[n].data = [document.images[n].width, document.images[n].height, 0]
    document.images[n].onclick = function() {if(this.data[2]<3){this.width+=this.data[0];this.data[2]+=1}else{this.width=this.data[0];this.data[2]=0;}}
   }
</script>



Posted By: yrizoud
Date Posted: 14 December 2011 at 4:24am
(Sorry for the slight JS offtopic)
It looks as if the javascript runs "too early", before all images are downloaded, so the width/height return a default value of 16x16 or something.
If I reload the page, the images are in browser cache, so it starts working correctly.



Posted By: DawnBringer
Date Posted: 14 December 2011 at 6:20am
Yeah, you're right. I've updated the online-version now to assign the zoom-feature after the page is completely loaded. Thanx.


Posted By: DawnBringer
Date Posted: 30 December 2011 at 5:59pm
Testing. Testing. This thread disappeared after spam-cleaning. [Seems like that comment bumped it out of oblivion]

Well, while I'm here why not list the stuff done so far for V1.4

* Ping-Pong mode for the Sprite-Sheet Animator added, max frame size now 512x512.

* Re-Tiler now allows 512x512, BG clearing.

* A new Image Statistics script

* A new Threshold + Apply FG->BG Gradient script

* Difference mode added to Apply Spare script

* A new Difference script that allows you to extract the difference of two images.



Posted By: neota
Date Posted: 23 January 2012 at 7:23pm
I'm interested in these scripts (That's a lot of work right there.. Respect.).
I always prefer to use the very latest version though, so... Do you have these in a GIT or SVN repository somewhere? (I particularly want to be able to use PingPong mode in the animator.)

Edit:
_DB_TOOLBOX is buggy on Linux. You are giving some filenames that are wrong (incorrect case).


Here's a diff correcting that:


--- __DBTOOLBOX.lua     2011-12-13 01:58:36.000000000 +1030
+++ _DBTOOLBOX.lua      2012-01-24 14:40:19.000000000 +1030
@@ -76,7 +76,7 @@
     "3D Palette Viewer (i)",   function () dofile("ani_db_3DPalette.lua"); end,
     "Curved ColorRamps (p)",   function () dofile("pal_db_CurveRamps.lua"); end,
     --"Reduce (Rare) Cols (i,p)",   function () dofile("scn_db_RemoveRarePixels.lua"); end,     
-    "SuperSort (p)",           function () dofile("pal_db_Supersort6.lua"); end,
+    "SuperSort (p)",           function () dofile("pal_db_SuperSort6.lua"); end,
     "Shuffle Palette (p)",     function () dofile("pal_db_ShufflePal.lua"); end,
     "Assign Spare 2 Current (p)",   function () dofile("pal_db_assignPalette.lua"); end,
     "[Back]", main
@@ -100,7 +100,7 @@
   selectbox("Brush Distortions",
     "Rotation (i/b)",             function () preBRU=1; prePIC=0; dofile("scn_db_Rotation.lua"); end,
     "Waves (i/b)",                function () preBRU=1; prePIC=0; dofile("scn_db_Waves_aa.lua"); end,
-    "FishEye (i/b)",              function () preBRU=1; prePIC=0; dofile("scn_db_FishEye.lua"); end,
+    "FishEye (i/b)",              function () preBRU=1; prePIC=0; dofile("scn_db_Fisheye.lua"); end,
     "[Back]", sf_brush
  );
 end
@@ -188,7 +188,7 @@
     ">OPTIMIZE & REMAP", sf_img_optimize,
     ">DISTORTIONS", sf_img_distort,
     ">DRAW SHAPES & GRIDS", sf_img_draw,
-    "Set Image Size (i)",        function () dofile("pic_db_setImageSize.lua"); end,
+    "Set Image Size (i)",        function () dofile("pic_db_SetImageSize.lua"); end,
     "Image 2 Brush (b)",         function () dofile("bru_db_Picture2Brush.lua"); end,
     "Fill Color w/ Brush (i)",   function () dofile("pic_db_FillColorWithBrush.lua"); end,
     "RubThru PenColor (i)",      function () dofile("pic_db_RubthruPencolor.lua"); end,
@@ -273,7 +273,7 @@
 function sf_demo()
   selectbox("Demos & Fun",     
   "Amiga BoingBall Brush (b)",function () dofile("bru_db_Amigaball.lua"); end,
-  "Oblique Logo (i)",         function () dofile("pic_db_obliqueLogo.lua"); end,
+  "Oblique Logo (i)",         function () dofile("pic_db_ObliqueLogo.lua"); end,
   "Line Demo (i)",            function () dofile("pic_db_LineDemo.lua"); end,
   --"TicTacToe Game! (i,p)",    function () dofile("scn_db_TicTacToe.lua"); end,
   "[Back]", sf_scene
@@ -326,7 +326,7 @@
   "Palette Operators  (i,p)",function () dofile("ani_db_PaletteOperators.lua"); end,
   "Spline Demo (i)",function () dofile("ani_db_SplineDemo.lua"); end,
   "Ellipse Demo (i,p)",function () dofile("ani_db_EllipseDemo.lua"); end,
-  "Iso Train (i,p)",function () dofile("ani_db_IsoTrain.lua"); end,
+  "Iso Train (i,p)",function () dofile("ani_db_isoTrain.lua"); end,
   "Oblique Palette Cubes (i)",function () dofile("ani_db_ObliquePal.lua"); end,
   "[Back]", main
  );




-------------
absolutely.


Posted By: DawnBringer
Date Posted: 23 January 2012 at 11:31pm
Ah, thanx for telling. It did occur to me the other day that some links had letters in the wrong case, but in windows it works fine, so I didn't sweat it. Though I'll be sure to fix this in the next update.

And, no...no repository for these scripts other than my computer ;) But give me an e-mail and I can send you the latest version the SpriteSheet-animator or any other script you like.


Posted By: sandrowski
Date Posted: 04 April 2012 at 4:41am
hi there!
first of all - sorry for my bad ENG language, i was bad in school :)

i download DBToolBox1.3. okay! good job!

But i have a trouble :(

1.
for example
:
i load my pic. after i chose _DBTOOLBOX>Image>Distortions>fisheye.
but i have error message - cannot open scn_db_FishEye.lua (no such file or dir)
it's sad :(

2.
okay
i chose Misc>PenColorSphere
but again error!
now i see message like "Error running script: bru_db_ColorSphere.lua:36: attempt to call global 'matchcolor2' (a nil value)"

how i can fix it? or what i did wrong?

p.s. grafx2 (ubuntu ver)


Posted By: DawnBringer
Date Posted: 04 April 2012 at 5:10am
1. Sorry, my fault...I mixed the lettercasing, the name of the physical script is "scn_db_Fisheye.lua" not "scn_db_FishEye.lua". Windows don't care so these (there are a few) wasn't noticed until recently. Will have this fixed in next version. For now you can either rename the script or edit the toolbox script (_DBTOOLBOX.lua). You can also run the script directly without going via the ToolBox.

2. Yeah, some of the scripts use new/wip features added to the Lua-scripting. I'm not sure if the latest Ubuntu versions has those implemented yet. But always get the latest version of Grafx2 for best compability.


Posted By: yrizoud
Date Posted: 04 April 2012 at 12:24pm
You could provide a bit of compatibility in the library, using something like :

function db.matchcolor2(...)
 ...
end
-- If grafx2 doesn't provide matchcolor2(), replace it with a lua implementation
if (not type(matchcolor2) == 'function') then
 matchcolor2 = db.matchcolor2
end

Same with drawline() :
if (not type(drawline) == 'function') then
 drawline = db.line
end



Posted By: DawnBringer
Date Posted: 06 April 2012 at 3:58pm
@Yrizoud: Ah, right...that's good to know. However in the case of matchcolor2 I would either have to re-route to matchcolor - which may give a different result, or use my own, very slow function which now also would require a palette-list to be generated at every call...effectively make it slit-your-throat slow.

...but maybe I could use this to present informative messages rather than having the scripts cryptically fail.


Posted By: Mark_Ian
Date Posted: 21 September 2012 at 7:43am
its complicated to run the scripts, but well worth it. thanks


Posted By: DawnBringer
Date Posted: 21 September 2012 at 8:13am
What makes it complicated exactly? You can just assign the Toolbox to a shortkey, I hope you know. Or do you find the scripts themselves complicated (coz yes, some of them are quite cryptical esp. since there isn't much room for explanations).

I'm getting pretty close to finish v1.4, so if there's anything ppl liked to see added or changed, now's the time to shout!


Posted By: yrizoud
Date Posted: 23 September 2012 at 6:57am
If the library is designed for a recent v2.4wip, can you please use the new "run()" instead of "dofile()" ? It helps the scripts run on other OSes.
Also, it doesn't have the same problem as dofile() with relative directories.



Posted By: DawnBringer
Date Posted: 23 September 2012 at 8:48am
Hm, ok. And with this at the start of the Toolbox...

if (type(run) == 'function') then
dofile = run
end

...There would be no need to change anything and it would be compatiable with older versions, right. (Running individual script directly would still use the real "dofile" however).


Posted By: yrizoud
Date Posted: 23 September 2012 at 10:22am
Yes, and if you keep the scripts (menu + individual scripts) in the same directory, it will keep working with older versions of Grafx2 too (we haven't even released 2.4, so 2.3 will stay the most frequent Linux version for a while)



Posted By: neota
Date Posted: 24 April 2013 at 4:06pm
FYI, something has changed in recent GrafX2 versions. the 'Resize image' script is no longer working (produces scrambled noise). The settings I use are just : Double X, Double Y, Simple Scale

-------------
absolutely.


Posted By: DawnBringer
Date Posted: 24 April 2013 at 4:40pm
Ok, that's a little weird as that's a pretty basic script. What's Grafx2 version are you running right now (I'm running 2.4.2035).
If you'd like you could test the latest (unreleased) version of the Toolbox and see if it has the same problems.


Posted By: neota
Date Posted: 24 April 2013 at 5:53pm
SVN r2062. Just to be sure I completely rebuilt and reinstalled GrafX2. No change in results.

Of course I won't pass up any opportunity to get my hands on the latest Toolbox :D PM'd.
(I agree that the script in question is so simple it can hardly go wrong, but it's worth a try.)

Edit: It turns out that this is probably a bug in Grafx2 getbackuppixel()


-------------
absolutely.


Posted By: neota
Date Posted: 25 April 2013 at 12:11am
I have found a fix: Insert a line 'finalizepicture()' after the setpicturesize(picX, picY) line

This is probably just a workaround, as it seems to me that the backup buffer should already contain some kind of sensible content at the point you go to scale the image. Anyway, if you're experiencing this, it's a usable workaround if you only want to scale up. It doesn't work for scaling down..

EDIT: yrizoud has confirmed that this bug was introduced in r2052 of GrafX2 (see the http://code.google.com/p/grafx2/issues/detail?id=530 - bug report )


-------------
absolutely.


Posted By: neota
Date Posted: 30 April 2013 at 7:12pm
I've explored the palette menu again and found that there are no 2-color 'generate ramp' functions. *

That surprised me, since the inbuilt GrafX2 'spread' function is predictable but not that high quality -- just a standard 'incorrect' interpolation through sRGB colorspace. If you're interested in including it, I could work up a script that does proper linear-RGB (or linear-HSL) interpolation, avoiding the errors caused by sRGB/HSL interpolation (brightness imbalance, discoloration of certain types of ramp). Let me know what you think.

I think there could also be benefit in a 'error diffusion' ramper, when working with a restricted colorcube; for example you can see these kinds of ramps in Amiga demoscene graphics, making sure the ramp is filled out with unique colors by distorting the intermediate colors between 'exact' ramp colors somewhat to achieve an appropriate brightness-gradient.
We'd need an API to get the current RGB-cube size from GrafX2 first though. I've filed an issue for that.


*EDIT: I just found the 'Curved Colorramp' function, which is based on 3 colors according to the documentation. I find it difficult to understand. With the new lua gui stuff being added to GrafX2 (see r2053-2057), perhaps we could get a type of button that allows you to choose a color from the palette. Specifying RGB channel values directly is pretty user-unfriendly.

Currently I opt to use GPick's http://code.google.com/p/gpick/wiki/BlendColors - "Blend Colors" dialog instead and eyedrop the result into GrafX2.
I agree that 3-color ramps are often better than 2-color., since they provide more context. I'd like to do this task purely in GrafX2, I just don't find the current UI friendly enough for that.


-------------
absolutely.


Posted By: DawnBringer
Date Posted: 30 April 2013 at 8:25pm
What about [Palette -> Curved ColorRamps]? (Edit: ok, you found it while I wrote this :D)
It takes the two PEN-COLORS as input values, the third manual value is an optional middle point (as default it's the average of the pencolors)

And I never seen any value in HSL ramps. But I'd love to see some more scripts for Grafx2 if you have good ideas.

I don't quite understand what you are talking about in the 2nd part, are you talking about generating colors, rendering ramps or what?

"I notice you never use LAB or LCH colorspaces in the DB-Toolbox code. Is this because you've tried it and found it unsuitable, it's too hard to implement correctly, too slow, it only roundtrips 99.5% of sRGB colors intact, or what?"

There's only RGB, everything else is derivatives. I have no interest in HSL-tweaks. Brightness-correction procedures takes care of problems with plain HSL and many other things. My quest in life is to understand the true shape of RGB-colorspace...I know it's a rectangular jellyblob, but to quantify it... :)


Posted By: neota
Date Posted: 30 April 2013 at 8:48pm
In newer versions of GrafX2 the GUI support is becoming more sophisticated, beyond inputbox(): Object oriented GUI building, so you can have control over individual GUI elements. I was saying that because the current Curved-Colorramps dialog is rather opaque (asking for direct RGB values), it would be more user friendly if we could replace the RGB sliders with a button that would let you pick a color directly from the palette.

When I say

Currently I opt to use GPick's http://code.google.com/p/gpick/wiki/BlendColors - "Blend Colors" dialog instead and eyedrop the result into GrafX2.

I mean, when I want to generate ramps. Since GrafX2's inbuild Spread function is too low quality, and the Curved Colorramps function currently requires that you write down the 3rd color's RGB values ahead of time, this is what I presently find more efficient.

In case you were also talking about this:


I think there could also be benefit in a 'error diffusion' ramper, when working with a restricted colorcube; for example you can see these kinds of ramps in Amiga demoscene graphics, making sure the ramp is filled out with unique colors by distorting the intermediate colors between 'exact' ramp colors somewhat to achieve an appropriate brightness-gradient.

I mean for example when RGB levels is set to 16 (Amiga), but you need finer stepping  in your palette ramp than that; Altering the hue so the intermediate colors have small incremental changes in brightness, rather than simply being quantized to the nearest 'true' approximation. It would be nice to not have to do that tweaking manually, but have the ramping code take care of it.

Hope that clarifies things :)

EDIT: re: HSL ramping: yeah, I don't like it myself, but a lot of programs seem to have it, so there must be some demand. I prefer its cousin, LCH ramping, which combines accurate brightness-interpolation with more interesting/painterly hue interpolation.


-------------
absolutely.


Posted By: DawnBringer
Date Posted: 01 May 2013 at 3:20pm
I mean for example when RGB levels is set to 16 (Amiga), but you need finer stepping in your palette ramp than that; Altering the hue so the intermediate colors have small incremental changes in brightness, rather than simply being quantized to the nearest 'true' approximation. It would be nice to not have to do that tweaking manually, but have the ramping code take care of it.


Ah, ok now I understand. Been thinking about this a little...and I suspect this may be a very complex problem (for a "perfect" solution).
A simple solution (for starters) would be to treat a limited colorspace as a palette (ex. Amiga 12bit = 4096 colors) and make a brightness-weighted colormatching for the values of the ramp. Error-diffusion would only enhance errors in the ramp...even iterative "check ahead" operations (inverted ED) could prove futile, since a single bad segment is enough to spoil things. I don't think there's any way good ramps can be consistently produced without tweaking the values of entire ranges, and playing on the fact that the brighter end of a ramp is less sensitive to bigger leaps in brightness.

Anyways, made a quick test by expanding the "Show AA colors"-script that does just this. These are examples from a space of 6 RGB shades (216 colors) and few 12 color ramps, with and without brightness-weighted colormatching. It looks fairly promising.



Posted By: neota
Date Posted: 01 May 2013 at 6:03pm

Anyways, made a quick test by expanding the "Show AA colors"-script that does just this. These are examples from a space of 6 RGB shades (216 colors) and few 12 color ramps, with and without brightness-weighted colormatching. It looks fairly promising.


That -is- looking good. I want to point out that the greyscale ramp seems glitched, though (doesn't contain all the 'pure' matches.)

There are a few known characteristics that could improve the above matching:

* Saturation usually increases for intermediates, since it's almost never that all three channels can be increased at once and not simply duplicate an existing color. I suggest restricting the matching for intermediate colors to colors that range from a 50% saturation decrease to a 50% saturation increase.
* Some weighting by hue also could help  (to avoid situations like that green/pink interleaving, which causes noticable visual separation -- top left ramp)


-------------
absolutely.


Posted By: DawnBringer
Date Posted: 01 May 2013 at 7:51pm
Nope, there are no "pure" matches, only intermediate values of two points. And our only objective here is to match a color with every value, with the minimum error - many small errors are better than one big. You can't have the cake and eat it.

No, Saturation usually decreases with interpolation. But with a limited colorspace you have to use heavy brightness-weights to find any potential candidates - and they are not always close and similar (in hue & saturation)...if they were, we wouldn't have a problem to begin with :D

Hue-weight: Brightness is king, so you can't ever touch that...and if you put weight on Hue, there's only the feeble Saturation left to screw with. And how is that gonna help your grayscales? ;)

As I said, for a generic solution this is probably the best you're gonna get. But there sure could be other, more complex & dynamic methods to achieve more visually pleasing ramps.






Posted By: neota
Date Posted: 01 May 2013 at 10:56pm
there are no "pure" matches, only intermediate values of two points

I presume you mean that all the 'natural' matches for the black->white gradient are not found because you are not actually interpolating between black and white (except in the first step), you're then interpolating between at least one distorted color and another, accumulating more error on each iteration. The ramp isn't a grayscale one any more. Certainly ramps that fitted the intent of the original ramp ('ramp from black to white') better could be generated by avoiding this recursive approach.




-------------
absolutely.


Posted By: DawnBringer
Date Posted: 02 May 2013 at 11:58am
There's no ED etc going on here. It's a pure ramp from black to white, but the range you have over a certain number of colors may not align very well with the existing grayscale colors. F.ex if you want a 4 color ramp in a 3 grayscale space, the two middle-colors can only match with the one & same available gray. (That's why we use brighntess-weight to find more matches).

(note that logic will pick the first purple ramp, while the green-pink is much better as these colors are complementary and could mix to form gray...here some ED may actually improve things?)

Just beacuse we make a grayscale-ramp, it doesn't mean that a given grayscale in the colorspace will have to be included in that ramp. We embark on a journey in space between two colors, moving straight with constant steps, at every step we stop and look which available color is closest to us...that's the color we pick for that step. We're not plotting a course amongst predetermined colors. We might WANT to try doing that...but then we'll need to use different methods.

Note: the same logic applies to all ramps, not just grayscale ones.



Posted By: DawnBringer
Date Posted: 14 May 2013 at 11:08am
Experimenting with adding an isometric projection option to the geoshapes script. This would allow you to quickly get the isometric version of any (symmetrical) geometric figure.



Posted By: neota
Date Posted: 02 August 2013 at 5:45pm
I've just made a simple tutorial which demonstrates how to use DBToolbox's fraction-based scaling to refit a too-small silhouette to the correct size:

http://finticemo.tumblr.com/post/57201267413/tutorial-scaling-a-too-small-outline-to-fit-as - Here is a link .



-------------
absolutely.


Posted By: DawnBringer
Date Posted: 03 August 2013 at 4:29am
Thanx for your hard work...but isn't that just a tutorial how to simply double the size of a brush? Something that you can do by just pressing Shift-h in GrafX2. Also note that the Fraction-scaling allows you to scale ANY fractions, like 11/7 (+57%) etc.

There's a lot of stuff behind the brush-scaling functions; too much to inform about in the interface...so there's some hidden power to explore, using different combos of settings, these f.ex:



However, these functions are not that great at smart-scaling up images at small increments like X2. Yrizoud have written a great Scale2x script (special algorithm to scale an image x2 in a neat way)... Couldn't find it at the homepage so I'll upload it http://hem.bredband.net/ricfha/bru_yr_Scale2x.lua - Here


Posted By: neota
Date Posted: 03 August 2013 at 4:09pm
Originally posted by DawnBringer

Thanx for your hard work...but isn't that just a tutorial how to simply double the size of a brush?


Haha.. what?

No, it's a tutorial on how to use the fractional scaling to go from a too-small size to fit in the desired size (my example target size in the tutorial is 64x64, and the 'original size' is 39 (39x37 IIRC), so the fraction is 64/39 (164%) for my example). If I'd wanted 2x, I would have just used the shortcut you mentioned.

Would you find it clearer if I erased the values from the fraction specifier fields in the screenshot?

EDIT: I've now done this. Thanks for illustrating that people may not read the info in the first image; I'm not sure how to resolve that issue though. Since I also wrote that info out as text, maybe I should just make the text more appealing.

Possibly scale2x would have improved results, although two scaling steps would then be needed (one to upsize 2x, which is too far, and the next to shrink down to the intended size.)

EDIT3:
It looks like Bilinear+Sprite mode is significantly better than plain scaling. Makes sense now that I think about it, so thanks for pointing that out.


EDIT2: I see at some point you edited your http://www.pixeljoint.com/forum/forum_posts.asp?TID=12854&PID=172711#172711 - somewhat earlier post to say
"There's only RGB, everything else is derivatives".
While I can respect making a project of exploring RGB, it would be far more accurate to say there's only http://en.wikipedia.org/wiki/CIE_1931_color_space - XYZ , since that is the colorspace representing the actual response of our vision, which RGB is based on.

RGB is only a subset of the colors we can see, and sRGB (the usual encoding that computer RGB is stored in) is now only a modest subset of all of the colors that can be displayed on a capable LCD display.

Similarly in the interests of factual correctness I must point out that LAB and LCH are not in any way HSL derivatives - they are XYZ derivatives. Hence being actually very good at what they do, unlike HS*.



-------------
absolutely.


Posted By: helcril
Date Posted: 14 August 2013 at 9:30pm
First of all, DawnBringer, thank you very much for such a great work on a big amount of useful tools you made!

I have a question about SpriteAnimator script. It uses fixed number of cycles of animation. And IMHO that's not always good. I've modified it a little, so I can control the number of cycles. But that's not exactly what I wanted.

How can I modify script to make it stop when some key pressed?
(I've tried to apply some chunks of code from other scirpts, but they doesnt work, and I have no experience in lua-scripting)


Posted By: DawnBringer
Date Posted: 15 August 2013 at 5:26pm
Cycles, as in number of times the animation will play, unless you stop it? Is there a reason you need to see it played a specific number of times? There's currently one free slot available for parameters, so I guess it could be added, if motivated.

In the next release the script will also be able to play anims ping-pong (forward-backward-forward...)

I've been looking into a pause function. It's possible to read mouse & keys (as seen in the 3D-palette script)...I've had some problems making a key-press work properly, but made it work decently with reading the mouse-button.

insert this code into the start-end loop:

moved, key, mouse_x, mouse_y, mouse_b = waitinput(0)
   if (mouse_b==1) then
    repeat
    moved, key, mouse_x, mouse_y, mouse_b = waitinput(0.05)
    until (mouse_b~=1)
   end   

Note however that this may interfer with scripts ability to detect the pressing of the escape-key (so you may have to hammer the key a bit to quit). Well, I'll have to investigate this issue further, as there seem to be some conflicts.


Posted By: helcril
Date Posted: 04 September 2013 at 6:40pm
Originally posted by DawnBringer

Cycles, as in number of times the animation will play, unless you stop it? Is there a reason you need to see it played a specific number of times? There's currently one free slot available for parameters, so I guess it could be added, if motivated.

   It was only temporary method of solving problem with too big default 100 cycles of animation, that I could made by myself.

Originally posted by DawnBringer

In the next release the script will also be able to play anims ping-pong (forward-backward-forward...)

   That would be fantastic.

Originally posted by DawnBringer

I've been looking into a pause function. It's possible to read mouse & keys (as seen in the 3D-palette script)...I've had some problems making a key-press work properly, but made it work decently with reading the mouse-button.

   Thank you very much again for this very useful toolbox you've made.


Posted By: Pixel_Outlaw
Date Posted: 13 January 2017 at 12:25am
I'm going to necropost the hell out of this particular thread and for very good reason.

The tile editor is freaking amazing in the latest version of GrafX2. Set your grid spacing, draw 9 adjacent squares of the same color, and then set it into tile mode. Any tile you draw on will automatically draw to the 8 adjacent tiles. It's amazingly powerful for getting continuous tiles and "breaking up the grid".


-------------
http://www.shmup-dev.com/forum/">



Print Page | Close Window