The Coiler strikes back and bites again!koitsu wrote:Or one can't because Python strikes again. I look forward to knowing what the bug there is.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.
First attempt at NES graphics, please comment!
Moderator: Moderators
- 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!
((λ (x) (x x)) (λ (x) (x x)))
Re: First attempt at NES graphics, please comment!
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:
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:
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...
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.
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
Last edited by koitsu on Wed Apr 20, 2016 9:36 pm, edited 1 time in total.
Re: First attempt at NES graphics, please comment!
Yup, that was literally my first reaction (not kidding either). And in the process, I found another bug too:Jarhmander wrote:The Coiler strikes back and bites again! :P
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
Re: First attempt at NES graphics, please comment!
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.
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.
Re: First attempt at NES graphics, please comment!
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.rainwarrior wrote:Here's what your last image looks like through the NTSC filter:
Re: First attempt at NES graphics, please comment!
Yeah, that's the same conclusion I reached. :-)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.
Re: First attempt at NES graphics, please comment!
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 )
( http://8088mph.blogspot.com/2015/04/cga ... rated.html )
Re: First attempt at NES graphics, please comment!
I stuffed it though my conversion tools and got this. Any good?
- Attachments
-
- test3.zip
- (2.68 KiB) Downloaded 286 times
- 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!
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.
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.
Re: First attempt at NES graphics, please comment!
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.
- 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!
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'.
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'.
Re: First attempt at NES graphics, please comment!
I guessed that's what you meant, but I wanted to make sure. Cheers.
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.
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
Re: First attempt at NES graphics, please comment!
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.koitsu wrote: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.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
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.
Re: First attempt at NES graphics, please comment!
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
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