First attempt at NES graphics, please comment!

A place for your artistic side. Discuss techniques and tools for pixel art on the NES, GBC, or similar platforms.

Moderator: Moderators

User avatar
Jarhmander
Formerly ~J-@D!~
Posts: 568
Joined: Sun Mar 12, 2006 12:36 am
Location: Rive nord de Montréal

Re: First attempt at NES graphics, please comment!

Post by Jarhmander »

koitsu wrote:
tepples wrote:If you still have the palette data, and you are willing to install Python and Pillow (see Windows instructions) and learn to use the command prompt, you can use the savtool.py program that ships with my on-NES graphics editor to attempt to reconstitute the CHR and NAM from the PNG.
Or one can't because Python strikes again. I look forward to knowing what the bug there is.
The Coiler strikes back and bites again! :P
((λ (x) (x x)) (λ (x) (x x)))
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: First attempt at NES graphics, please comment!

Post by koitsu »

The original source file (test3.png) is also RGB. I can't seem to get ImageMagick to do the conversion into whatever it is your program demands:

Code: Select all

D:\downloads\editor-0.05>..\ImageMagick\convert.exe -verbose -define png:color-type=3 -resize 256x240 test3.png test4.png
test3.png PNG 512x480 512x480+0+0 8-bit sRGB 18.9KB 0.016u 0:00.017
test3.png=>test4.png PNG 512x480=>256x240 256x240+0+0 8-bit sRGB 0.031u 0:00.020
convert.exe: Cannot write PNG8 or color-type 3; colormap is NULL `test4.png' @ error/png.c/WriteOnePNGImage/9270.
The -define png:color-type=3 argument comes from here.

It looks like the source image uses sRGB colour space, but it's a "truecolour" image, even though the bit depth is 8. Screwing around with -define png:bit-depth doesn't fix it either. Below comes from identify.exe -verbose test3.png -- note the "Properties" section:

Code: Select all

D:\downloads\editor-0.05>..\ImageMagick\identify.exe -verbose test3.png | more
Image: test3.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 512x480+0+0
  Resolution: 47.24x47.24
  Print size: 10.8383x10.1609
  Units: PixelsPerCentimeter
  Type: Palette
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    Pixels: 245760
    Red:
      min: 0 (0)
      max: 175 (0.686275)
      mean: 12.0967 (0.0474382)
      standard deviation: 19.8448 (0.0778226)
      kurtosis: 19.1082
      skewness: 3.01808
      entropy: 0.456241
    Green:
      min: 0 (0)
      max: 238 (0.933333)
      mean: 18.7621 (0.0735767)
      standard deviation: 38.1136 (0.149465)
      kurtosis: 11.8537
      skewness: 3.27242
      entropy: 0.616345
    Blue:
      min: 0 (0)
      max: 238 (0.933333)
      mean: 70.9639 (0.27829)
      standard deviation: 78.8948 (0.309392)
      kurtosis: -1.66944
      skewness: 0.369543
      entropy: 0.581827
  Image statistics:
    Overall:
      min: 0 (0)
      max: 238 (0.933333)
      mean: 33.9409 (0.133102)
      standard deviation: 51.868 (0.203404)
      kurtosis: 4.21331
      skewness: 2.44243
      entropy: 0.551471
  Colors: 8
  Histogram:
    127020: (  0,  0,  0) #000000 black
     24696: (  0, 50,102) #003266 srgb(0,50,102)
      3360: (  0,109,153) #006D99 srgb(0,109,153)
      8456: (  0,116, 60) #00743C srgb(0,116,60)
     77324: ( 33, 13,173) #210DAD srgb(33,13,173)
      1656: ( 44,200,112) #2CC870 srgb(44,200,112)
      2116: ( 71,200, 32) #47C820 srgb(71,200,32)
      1132: (175,238,238) #AFEEEE PaleTurquoise
  Rendering intent: Perceptual
  Gamma: 0.45455
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Background color: white
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 512x480+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Zip
  Orientation: Undefined
  Properties:
    date:create: 2016-04-20T15:32:47-07:00
    date:modify: 2016-04-20T15:32:02-07:00
    png:gAMA: gamma=0.45454544 (See Gamma, above)
    png:IHDR.bit-depth-orig: 8
    png:IHDR.bit_depth: 8
    png:IHDR.color-type-orig: 2
    png:IHDR.color_type: 2 (Truecolor)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height: 512, 480
    png:pHYs: x_res=4724, y_res=4724, units=1
    png:sRGB: intent=0 (Perceptual Intent)
    signature: f52fcdc1c44815504760255e0d05419c091383538b181f1213d63e540feda438
  Artifacts:
    filename: test3.png
    verbose: true
  Tainted: False
  Filesize: 18.9KB
  Number pixels: 246K
  Pixels per second: 11.17MB
  User time: 0.016u
  Elapsed time: 0:01.021
  Version: ImageMagick 6.9.2-8 Q16 x64 2015-12-05 http://www.imagemagick.org
In other words: PNG support with your program is going to be iffy at best given that, odds are, things are going to be outputting sRGB with truecolour and not indexed. This is probably outside of your hands, but yeah, explicitly stating what the requirements are somewhere (either in documentation or -help usage) would be good...
Last edited by koitsu on Wed Apr 20, 2016 9:36 pm, edited 1 time in total.
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: First attempt at NES graphics, please comment!

Post by koitsu »

Yup, that was literally my first reaction (not kidding either). And in the process, I found another bug too:

Code: Select all

D:\downloads\editor-0.05>..\ImageMagick\convert.exe -verbose -define png:color-type=3 test3.png test4.png

test3.png PNG 512x480 512x480+0+0 8-bit sRGB 18.9KB 0.031u 0:00.029
test3.png=>test4.png PNG 512x480 512x480+0+0 8-bit sRGB 9c 8.64KB 0.016u 0:00.010

D:\downloads\editor-0.05>C:\Python27\python.exe tools\savtool.py test4.png test4.sav
Traceback (most recent call last):
  File "tools\savtool.py", line 790, in <module>
    main()
  File "tools\savtool.py", line 699, in main
    sav = load_bitmap(infilename)
  File "tools\savtool.py", line 423, in load_bitmap
    return bitmap_to_sav(Image.open(filename))
  File "tools\savtool.py", line 388, in bitmap_to_sav
    raise IndexError("image has %d distinct tiles, which exceeds 256")
IndexError: image has %d distinct tiles, which exceeds 256
This is because the image is 512x480 -- but I particularly chuckled at the literal %d. I can't tell from any Python documentation I've skimmed whether or not IndexError() supports % conversion expandos. Nothing in the language ever gives me the impression such things are supported, instead it's always "hey man just use + for concatenation and let magic fairies and unicorns and rainbow pixies read your mind". Yeah, too bad computers don't work that way. Don't worry, this isn't a Python-specific bitch session either: Ruby is the same way.
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: First attempt at NES graphics, please comment!

Post by lidnariq »

The most recent time I wanted a tool to deal with a destination format that must be palletized, I reluctantly concluded that the only possible vehicle for this was the crustiness that is GIF.

Well, or XPM, but let's be serious.

Anything else allows for UI failure where the generating program can silently save an image in the wrong format, requiring the converter to either fail or include its own conversion tools.
Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: First attempt at NES graphics, please comment!

Post by Sik »

rainwarrior wrote:Here's what your last image looks like through the NTSC filter:
Image
You know, that looks so similar to one of the CGA palettes (black-turquoise-purple-gray) that now it makes me wonder how it'd look like if redrawn for CGA.
User avatar
Myask
Posts: 965
Joined: Sat Jul 12, 2014 3:04 pm

Re: First attempt at NES graphics, please comment!

Post by Myask »

User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: First attempt at NES graphics, please comment!

Post by koitsu »

lidnariq wrote:The most recent time I wanted a tool to deal with a destination format that must be palletized, I reluctantly concluded that the only possible vehicle for this was the crustiness that is GIF. ... Anything else allows for UI failure where the generating program can silently save an image in the wrong format, requiring the converter to either fail or include its own conversion tools.
Yeah, that's the same conclusion I reached. :-)
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: First attempt at NES graphics, please comment!

Post by lidnariq »

Eh, if you used one of the composite color modes I bet it'd be nice.

( http://8088mph.blogspot.com/2015/04/cga ... rated.html )
Rahsennor
Posts: 479
Joined: Thu Aug 20, 2015 3:09 am

Re: First attempt at NES graphics, please comment!

Post by Rahsennor »

I stuffed it though my conversion tools and got this. Any good?
Attachments
test3.zip
(2.68 KiB) Downloaded 286 times
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: First attempt at NES graphics, please comment!

Post by FrankenGraphics »

Wow, this thread really took off after i went to sleep.

The zip worked wonders! The only thing i had to reassign was a single odd tile. The palettes are in different order but that's only to expect and has no practical effect (i tend to make them read black, light, medium, dark from left to right, which probably is counterintuitive). And most of the unused tiles in char was garbage anyway. Everything is back to normal. Thanks a lot!

I'll be sure to save everything in separate files from now on.


--
Regarding CGA, 8-bit guy does a quick redeeming roundup of the hardware in this vid.
Rahsennor
Posts: 479
Joined: Thu Aug 20, 2015 3:09 am

Re: First attempt at NES graphics, please comment!

Post by Rahsennor »

Could you be more specific about what my converter got wrong? The palette was generated automatically, so there's not much I can do about the order, but if the the output has errors or unused tiles, that's a bug.
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: First attempt at NES graphics, please comment!

Post by FrankenGraphics »

Nevermind, i discovered it was just a quirk with nesst. If one is using the mouse to double click on a file in the open dialogue, the last click registers as a click in the nametable viewer if it is directly underneath in windows, which changed that cell to the first selected tile. The order of palette colours doesn't bother. It was kind of redundant of me to remark even.

EDIT: to be perfectly clear, no unused tiles were in the new .chr. It was just my vague way to say 'very few tiles of importance got lost when the session file crapped, so it'll be a breeze to continue with your reconstitute files. i'm obliged'. :beer:
Rahsennor
Posts: 479
Joined: Thu Aug 20, 2015 3:09 am

Re: First attempt at NES graphics, please comment!

Post by Rahsennor »

I guessed that's what you meant, but I wanted to make sure. Cheers. :beer:

I made a ROM of it to check how it looked on various emulators, so I may as well post it. I don't have a flash cart to view it on hardware myself.
Attachments
test3-rom.zip
(2.61 KiB) Downloaded 270 times
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: First attempt at NES graphics, please comment!

Post by tepples »

koitsu wrote:

Code: Select all

D:\downloads\editor-0.05>C:\Python27\python.exe tools\savtool.py test4.png test4.sav
Traceback (most recent call last):
[...]
  File "tools\savtool.py", line 388, in bitmap_to_sav
    raise IndexError("image has %d distinct tiles, which exceeds 256")
IndexError: image has %d distinct tiles, which exceeds 256
This is because the image is 512x480 -- but I particularly chuckled at the literal %d. I can't tell from any Python documentation I've skimmed whether or not IndexError() supports % conversion expandos.
My fault. I intended to type % num_tiles but must have forgotten at that time. I don't know whether I've fixed this bug in my local tree. I'll check when I'm back to that computer. Thank you for reporting it. I haven't got a lot of feedback in its own topic.

From lidnariq's post, I infer demand for a feature to allow use of either RGB or indexed color. I'll consider it for 0.06 at the same time I port it from Python 2 to Python 3.
User avatar
Marscaleb
Posts: 240
Joined: Fri Sep 11, 2015 10:39 am
Contact:

Re: First attempt at NES graphics, please comment!

Post by Marscaleb »

Holy wow this thread exploded into a direction I did not expect.

On the subject of how these images look on actual hardware, I want to share this interesting video about CGA graphics on a composite signal.
https://www.youtube.com/watch?v=niKblgZupOc

If you're in a hurry, here is the really fascinating part:
https://youtu.be/niKblgZupOc?t=6m23s
Post Reply