Author Topic: ColorIt - a coloring book kind of drawing program.  (Read 3900 times)

0 Members and 1 Guest are viewing this topic.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
ColorIt - a coloring book kind of drawing program.
« on: October 26, 2020, 05:29:06 pm »
This isn't a serious program, I just felt making something while enjoying a cup of coffee today.  You color a line drawing image with basic colors, like you would with a coloring book image using crayons.   Select a color, fill in color where desired.  There's an undo & restart.  The line drawing supplied here was done with @SierraKen 's paint Pixels 8 app posted on this forum.  You can replace my default image with one of your own, just name it colorit-image.png and make it 700x700.  There are 3 files in the .zip - make sure they all are in the same directory. 

- Dav

Download source (36k) ----> 

Default image...
 
colorit-1.png


Coloring it....
 
colorit-2.png

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: ColorIt - a coloring book kind of drawing program.
« Reply #1 on: October 27, 2020, 02:23:03 pm »
Nice relax, Dav! :)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: ColorIt - a coloring book kind of drawing program.
« Reply #2 on: October 28, 2020, 04:44:06 pm »
Hi Dav,

I had an idea for converting an image to a ColorIt Layout here is first crude attempt taking this image:
 
Image to convert.PNG


and getting shades outlined in black with shades in for grey scales:
 
Possible ColorIt Image to Paint.PNG



Probably have better luck with cartoon or less detailed images ;-))
PS, some blunder is causing white line at bottom edge as circled with "?"

* Image Outline and Shade.zip (Filesize: 253.56 KB, Downloads: 135)
« Last Edit: October 28, 2020, 04:46:40 pm by bplus »

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: ColorIt - a coloring book kind of drawing program.
« Reply #3 on: October 28, 2020, 05:34:05 pm »
Animated images returning best output. Nice work, Bplus!

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: ColorIt - a coloring book kind of drawing program.
« Reply #4 on: October 28, 2020, 06:30:34 pm »
Bplus,

I think that some of the problem may be with the image itself. On average, the 'colour' level is quite flat. Not a lot of differences between colours. (see attched) Perhaps a 'daytime' image may work better. I even tried converting to 'cartoon' in Gimp. It kind of worked but needed greater contrast in colours.

 
colorlevel.png


Curious. Is it possible for you to modify 'your' cartoon step to draw slightly thicker lines?

Logic is the beginning of wisdom.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: ColorIt - a coloring book kind of drawing program.
« Reply #5 on: October 28, 2020, 06:53:27 pm »
Neat pic, @bplus.  It does look like a hard one to convert to a line drawing - I'll play around with too.   

- Dav

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: ColorIt - a coloring book kind of drawing program.
« Reply #6 on: October 29, 2020, 11:42:39 am »
Quote
Curious. Is it possible for you to modify 'your' cartoon step to draw slightly thicker lines?

@johnno56

Yes, anywhere you:
Code: QB64: [Select]
  1. pset(x,y), black
use:
Code: QB64: [Select]
  1. circle_fill x, y, smallRadius, black
instead, you can do that!

I also had more intense grey scales by using a much smaller nRound (see code) variable, screen shot was at 64 rounding to 4 shades use 5, 10, 15... for different scales of detail.

Code: QB64: [Select]
  1. _TITLE "ColorIt Experiment:  a few SLEEP steps press any..." 'b+ 2020-10-28
  2. ' Attempt at making a coloring book outlines.
  3. ' Results: well maybe this will help layout your masterpiece :)
  4.  
  5. ' The last image is black outlines with shading or grey level hints
  6.  
  7. DEFLNG A-Z
  8. DIM SHARED xmax, ymax
  9. img = _LOADIMAGE("Halloween.jpg", 32)
  10. xmax = _WIDTH(img&)
  11. ymax = _HEIGHT(img&)
  12. SCREEN _NEWIMAGE(xmax, ymax, 32)
  13. _DELAY .25
  14. DIM gs(xmax, ymax), gs2(xmax, ymax)
  15. _PUTIMAGE , img
  16. nRound = 64 'this rounds to 4 shades of gray  <<<<<<<<<<<<<<< adjust number of levels = 255 / nRound
  17. FOR y = 0 TO ymax - 1
  18.     FOR x = 0 TO xmax - 1
  19.         c~& = POINT(x, y)
  20.         r = _RED32(c~&)
  21.         g = _GREEN32(c~&)
  22.         b = _BLUE32(c~&)
  23.         gs(x, y) = INT(((r + g + b) / 3) / nRound) * nRound 'round the grey
  24.     NEXT
  25. COLOR , &HFFFFFFFF: CLS
  26. FOR y = 0 TO ymax - 1
  27.     FOR x = 0 TO xmax - 1
  28.         PSET (x, y), _RGB32(gs(x, y), gs(x, y), gs(x, y), 90)
  29.     NEXT
  30.  
  31. COLOR , &HFFFFFFFF: CLS
  32. FOR y = 0 TO ymax - 1
  33.     FOR x = 0 TO xmax - 1
  34.         IF gs(x, y) <> gs(x + 1, y) THEN PSET (x, y), &HFF000000: gs2(x, y) = 1
  35.     NEXT
  36. FOR x = 0 TO xmax - 1
  37.     FOR y = 0 TO ymax - 1
  38.         IF gs(x, y) <> gs(x, y + 1) THEN PSET (x, y), &HFF000000: gs2(x, y) = 1
  39.     NEXT
  40.  
  41. COLOR , &HFFFFFFFF: CLS
  42. FOR x = 0 TO xmax - 1
  43.     FOR y = 0 TO ymax - 1
  44.         IF gs2(x, y) THEN PSET (x, y), &HFF000000
  45.     NEXT
  46.  
  47. FOR y = 0 TO ymax - 1
  48.     FOR x = 0 TO xmax - 1
  49.         PSET (x, y), _RGB32(gs(x, y), gs(x, y), gs(x, y), 90)
  50.     NEXT
  51.  
  52.  
« Last Edit: October 29, 2020, 11:48:58 am by bplus »