It is currently Sun Jul 22, 2018 6:13 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Mon Jul 09, 2018 8:43 am 
Offline
User avatar

Joined: Tue Jun 24, 2008 8:38 pm
Posts: 1628
Location: Fukuoka, Japan
I'm sure it was discussed before but I cannot find the appropriate threads on the subject.

I'm looking for a tool that would convert an existing image so it could be used on the nes. I just want to convert some logo that are already using a low count color to something that would be close to what the nes would use.

I found the tool by thefox which convert an image to a nes file. It looks exactly how I would like it to be (color and result) but since I need the chr/pal only, I cannot really use it, unfortuately. And from the look of it, it does a lot of processing to make it look the way it is (which is impressive for an automated tool by the way!).

I will continue to search on the forum for the time being.

Thank you in advance for any information on the subject.


Top
 Profile  
 
PostPosted: Mon Jul 09, 2018 8:53 am 
Offline
User avatar

Joined: Thu Aug 13, 2015 4:40 pm
Posts: 272
Location: Rio de Janeiro - Brazil
You could probably use thefox's tool inside a batch file that after it's done splits the rom into the chr part that you want.

_________________
http://nesrocks.com/blog/superpitfall30th/


Top
 Profile  
 
PostPosted: Mon Jul 09, 2018 9:04 am 
Offline
Formerly WheelInventor

Joined: Thu Apr 14, 2016 2:55 am
Posts: 1657
Location: Gothenburg, Sweden
Use Kasumi's I-CHR. If you provide it with a palette map when importing, you're likely to get perfect results.

You can also use NESST with some conditioning, usually with a trial and error phase, but it tends to mess up the bit planes and palettes more often than not. So I-CHR is way better for this task.

_________________
http://www.frankengraphics.com - personal NES blog


Top
 Profile  
 
PostPosted: Mon Jul 09, 2018 9:57 am 
Offline
User avatar

Joined: Tue Jun 24, 2008 8:38 pm
Posts: 1628
Location: Fukuoka, Japan
@nesrocks

Since the test picture was more complicated than I thought, it is using (my guess) many banks to simulate all the details of the image with all the colors (I think sprite are used too). So the size of chr data is too big in that case. Still, it's quite impresive how close to the original it looked.

@FrankenGraphics

nesst crashed on the bmp and as for i-chr, I still don't know how to use it so I guess I will need to read the manual ^^;; Right now I'm testing with some existing company logo like, for example, the initCreate one used in "bloodstained, curse of the moon" and the best result is with thefox tool. So I guess if the logo, even thought simple, contains too many color or details, I will need to reduce the color count more if I want i-chr to work better (I'm guessing).

I'm not really an artist so for now my approach is maybe not appropriate. Still, a lot of fun to test many pictures to see how well they get converted. My test will be useful once I have something more concrete to use. For now I'm mostly getting back in nesdev, after 9 years of hiatus. C with asm is quite interesting, I like it.


Top
 Profile  
 
PostPosted: Mon Jul 09, 2018 10:21 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20283
Location: NE Indiana, USA (NTSC)
I wrote a tool called "savtool.py" to manipulate NES background images, converting them among a PNG (or other lossless image formats compatible with Pillow, the fork of Python Imaging Library), an 8K .sav file that contains pattern table and nametable data, and separate .chr and .nam files. It was originally to get files in and out of my graphics editor that runs on an NES, but I ended up using that converter far more than the editor.

Drawback: You have to specify a 32-nibble palette string.


Top
 Profile  
 
PostPosted: Mon Jul 09, 2018 10:33 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2155
Location: DIGDUG
Quote:
nesst crashed on the bmp


It should be 128x128 (or maybe 256x240 ?) BMP indexed-color with 16 colors, And frequently it doesn't import the palette correctly.

I prefer to reduce to B+W, then index to 4 colors, then back to RBG, then index to 16 colors, then export BMP.

Then manually choose the 4 colors in NESST.

EDIT.
Another easy method. In GIMP / Photoshop, reduce image to 128x128, then reduce to indexed 4 colors (any), then select all, copy. Open YY-CHR, paste.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Mon Jul 09, 2018 10:54 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3435
Location: Mountain View, CA
Is the BMP compressed? Does the tool support BMP compression? If not, what will it do if handed a BMP with compression? Etc. etc. etc...


Top
 Profile  
 
PostPosted: Mon Jul 09, 2018 11:25 am 
Offline
User avatar

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1154
To use I-CHR save your image as a PNG, instead of a BMP. Then just open the png file (with ctrl+o) after the program is already running, or drag the png file onto the exe. It'll create a folder for you with the files you need or display the reasons why it couldn't with marked pixels. (Toggle viewing error pixels with spacebar.) Assuming there were errors, you can fix them in the image editor of your choice, resave the file and press 'R' in I-CHR to try to export again.

It has two known bugs that won't affect most people.

1. Any PNGs with semi transparent pixels will have an odd result.
2. Filenames with a number >= INT_MAX or < INT_MIN in them won't load.

Beyond that it should load any PNG regardless of if it's indexed or how it's indexed, or the size of the image or anything else. I-CHR will crop image widths or heights to the nearest multiple of 16, though. (NES Screen Tool requiring data massaging beforehand is exactly why I wrote I-CHR. Well, that and NES Screen Tool lacks animation support!)

But it only works on things that are already NES ready. I've considered adding color quantizing to it, but since Aseprite already does that quite well, (Sprite, Color Mode, RGB Color. Create palette from current sprite, input a number of colors. Sprite, Color Mode, Indexed) it's pretty low on the list. Even then, an 8 color image doesn't guarantee < 4 colors in a 16x16 region so quantization alone will really only help the sprite import side of things. thefox's tool is indeed really impressive. (The non public version of I-CHR has an option to automatically turn error areas into a sprite overlay, but I feel like I'll never get that version of the program to a state that I'm comfortable releasing.)

I-CHR does mark error areas to help you make fixes yourself, but it's not very convenient in the public version because that one doesn't having zooming/panning.

Edit: If thefox's tool gives you VISUAL output you like, but not the FILES you want. Use thefox's tool to make a ROM, then import a PNG screenshot of that ROM in I-CHR. (This topic did make me think of an algorithm that might work on arbitrarily colored images but at the rate I'm going I'll never even finish cleaning up the UX for the sprite import stuff...)

Edit2: Nevermind, I guess. I just read the post that says it might be using splits to use more than 256 tiles.

_________________
https://kasumi.itch.io/indivisible


Top
 Profile  
 
PostPosted: Mon Jul 09, 2018 6:30 pm 
Offline
User avatar

Joined: Tue Jun 24, 2008 8:38 pm
Posts: 1628
Location: Fukuoka, Japan
@tepples

I will test it once I have a chance. Since it's in python, maybe it could be updated to read a palette file, I guess? I could try to add it, once I see what I can do with it.

@dougeff

I have been naively experimenting with files that have not been "massaged" (is it appropriate to use that in English regarding updating a file? ^^;;) with lower color count to see what the tools can do. Since I do not know them yet, I just wanted to see the result from non optimized file. I think I now know that some work is required :)

@koitsu

Good question. I just converted the png to bmp with gimp and nesten didn't mention anything about the format except for bmp so I didn't check that far. It could be either that (compression) or the color count was too high. Will check the format.

@Kasumi

My original test file was a png and only used that with your tool. It did convert to some degree but there was some error (I think, from the name of the files in the resulting folder) and didn't know what to do with them yet. Like mentioned above, I naively tested non optimized files so my guess is the file would have never worked properly in the first place. I did reduce to 16 colors but I think the picture I tested, even though the color count was lower, was maybe too complicated for automation. I wanted to know how much could be done since I will need later to convert some image. My test samples is giving me a good idea of what can be done (i.e. some manual work is required with sprites etc if you want to have higher color count).

I will include the test image, since it will give a better idea of how much not optimized it was. I took a screenshot of a logo of a recent game (bloodstained), reduced the size to 256x240 and tested it, as-is, in a few tools. thefox tool gave 100% the same result but the wizardly done with the tool makes it hard to re-use later in an actual project.

Now I know that some work with be required by an artist (which I'm not) if some existing logo are to be imported.


Attachments:
test1.png
test1.png [ 8.92 KiB | Viewed 297 times ]
Top
 Profile  
 
PostPosted: Mon Jul 09, 2018 11:23 pm 
Offline
User avatar

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1154
That image has 1621 colors! I-CHR's only for stuff that's already not breaking NES restrictions. I guess I misunderstood when you said already low color like the NES.

Here's an "automatic" conversion of the logo (full disclosure: not your specific image of the logo) from the non public I-CHR using the power of sprite overlays:
Attachment:
INTILOGO.nes [40.02 KiB]
Downloaded 15 times

All I did beforehand was quantize it to 10 colors and resize it (with nearest neighbor to have less antialiasing) using Aseprite. There may be gaps because of 8 sprites per scanline. (The ROM doesn't have flickering built in yet.) Some things that are the same color in the source image end up as different colors when used in the sprite vs the background layer. I know why, but it's actually not super simple to fix. (That's actually one of many things this test found, so thanks for that!)

edit: It works by pulling pixels that would cause background errors onto a new layer until there are no errors left. That method will obviously create hundreds of sprites depending on how spaced the colors are, it's not a magic bullet.

edit2: The difference between this tool and thefox's is that this wants to be pixel lossless. (It wants to display the exact same image it's given, just with the NES palette.) For this reason I get the impression it will fail at most of what you're trying, but if you want to try this version PM me. It doesn't export the sprite CHR or the sprite positions, but that's easy enough to rip from the ROM/OAM memory in NES. There's no scanline magic, but know there totally are bugs and this isn't the part of the program I'm focusing on right now. (It may not even make the next release.)

edit2: I tried your actual image (rather than the logo I resized myself) and it wasn't feasible even at 8 colors. Here's the 7 color version:
Attachment:
INTILOGO7.nes [40.02 KiB]
Downloaded 8 times

It still needs 73 sprites, but the ones that got dropped don't seem to have much effect. The colors aren't great either, but part of that is how Aseprite quantized it.

_________________
https://kasumi.itch.io/indivisible


Top
 Profile  
 
PostPosted: Tue Jul 10, 2018 12:20 am 
Offline
User avatar

Joined: Tue Jun 24, 2008 8:38 pm
Posts: 1628
Location: Fukuoka, Japan
@Kasumi

The image I provided was the screenshot from the game, resized only without any color indexing. That was quite naive to expect it would work but the goal was to research was is possible and now I have a better idea about it (I did test it with 256 and 16 color too). thefox tool creates the most accurate color but is not very practical to use in an actual project because of the data is big (maybe there are way to optimize with reduced image color, who knows, more testing is required since I do not know the tool yet).

The example you made with your own image is quite good, it's very close to the original :) So the results of those tests is to use existing image that are not nes specific will require a lot of processing. Your tool will be quite useful with a properly optimized image.

Thanks for the testing and feedback, I really appreciate it!


Top
 Profile  
 
PostPosted: Tue Jul 10, 2018 6:35 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20283
Location: NE Indiana, USA (NTSC)
Here's another try that uses all background.

First, I replaced the text color with savtool's idea of what color $12 is (#4051d0). Then I aligned the logo better with the attribute grid by moving it up 2 pixels and to the left 3 pixels. (On the NES, scrolling can compensate for this move.)
Attachment:
inticreates1.png
inticreates1.png [ 7.78 KiB | Viewed 216 times ]


I iterated on the palette until I found something that closely represented the gradient of the logo with few colors. (To show what a conversion looks like without saving it, you can use --show instead of an output filename.) It turned out to need only 3 of the 4 subpalettes to look reasonable.
Code:
../tools/savtool.py inticreates1.png --palette 2028122B201612142016122720242424 --show
../tools/savtool.py inticreates1.png --palette 2028122B201612142016122720242424 inticreates1-out.png


Then I edited inticreates1-out.png to add dithering in the gradients, forming inticreates2.png
Attachment:
inticreates2.png
inticreates2.png [ 1.85 KiB | Viewed 216 times ]


Once an image obeys PPU background limits, it can be converted to a .sav for display in the editor on an authentic NES and PowerPak.
Code:
../tools/savtool.py inticreates2.png --palette 2028122B201612142016122720242424 inticreates2.sav


From there, the .chr and .nam can be extracted for compression and use in an original NES program.
Code:
../tools/savtool.py inticreates2.sav inticreates.nam
../tools/savtool.py inticreates2.sav inticreates.chr


Top
 Profile  
 
PostPosted: Tue Jul 10, 2018 7:59 am 
Offline
User avatar

Joined: Tue Jun 24, 2008 8:38 pm
Posts: 1628
Location: Fukuoka, Japan
@Tepples

Very nice result! So from what I understand you where able to make it works without sprites, right? If that so then it's a good balance between compromise and functionality. The only thing is I need to learn more about is how to find where the issues are so I can optimize the picture the way you did. I don't have that experience yet so I think it's time to get my hands dirty. Thanks again!

So many great tools and results, I'm quite happy to have asked about it. Can't wait to use them on my current project.


Top
 Profile  
 
PostPosted: Tue Jul 10, 2018 9:23 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 3090
Location: Tampere, Finland
Kasumi wrote:
Edit2: Nevermind, I guess. I just read the post that says it might be using splits to use more than 256 tiles.

Yeah it doesn't optimize the tile count at all, its output is essentially a bitmap. Moreover, it uses 8x16 attribute areas by switching nametables every 8 scanlines. It's not really designed for use cases like this, although it can be used to get a general idea about what is possible.

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi


Top
 Profile  
 
PostPosted: Wed Jul 18, 2018 11:57 am 
Offline
User avatar

Joined: Fri Nov 24, 2017 1:36 pm
Posts: 64
Location: Argentina
This is my converter of images to NES based in gallleryNES of no-carrie

https://maquinaslibres.noblogs.org/files/2018/07/img2nam.zip

It is something that wanted to arm does a lot and now did me a time


Attachments:
File comment: 4232.cf original
4232.png
4232.png [ 43.79 KiB | Viewed 59 times ]
File comment: 4232.cf in NES
nes.4232.cf_.robot_.png
nes.4232.cf_.robot_.png [ 18.81 KiB | Viewed 59 times ]
File comment: capi in NES
2018-07-09-102053_640x480_scrot.png
2018-07-09-102053_640x480_scrot.png [ 16.8 KiB | Viewed 61 times ]
File comment: capi
logo.gif
logo.gif [ 1.93 KiB | Viewed 61 times ]

_________________
https://maquinaslibres.noblogs.org/tag/8bit/
http://4232.cf/
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group