Graphics - Tools

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Graphics - Tools
by on (#136810)
I see a lot of dev tools out there, especially for graphics, but are any of them capable of exporting custom graphics in a format usable in an NES cartridge? I'm not exactly sure how this would work but I can't imagine that with all the brain power in this community that no one has come up with a tool for this.

I have been using Pyxel Edit to make background and sprite graphics. It can export the tile sets and tile matrix like other programs seem to be able to also do. From this point, if I'm understanding things correctly, each tile has to then be coded line by line in assembly. I'm still trying to wrap my head around how graphics are coded in assembly so maybe I'm missing something obvious that prevents this kind of functionality. Can anyone point me to a tool for this or school me on why this is not possible?

Thanks!
Re: Graphics - Tools
by on (#136813)
Once you have a tile set or any other binary data in a format usable by the NES, you can include it in your program by using an .incbin statement in the proper section. (Which section to use depends on whether your project uses CHR RAM or CHR ROM.) Heck you could even use a "normal" paint program, so long as it can output in indexed color format, and convert your .png files to .chr files as part of your project's build process.

See PNG to CHR conversion and .incbin in action in my ca65 project templates for NES and Super NES.
Re: Graphics - Tools
by on (#136821)
Thanks Tepples! I looked into using YY-CHR and Shiru's NES Screen Tool but I'm having trouble converting my PNG files to the correct BMP files so that they can then be converted to CHR. When I try to import them into either program I keep getting messages saying that they are not the right kind of BMP or they are not the right size.

The link in your response takes me to another thread, what am I supposed to click on to see the conversion in action?
Re: Graphics - Tools
by on (#136822)
From the post I linked:

"A basic example (NROM-128) and a switching example (SGROM/SNROM) can be found here (updated 2014-11-09)."

That points to this page:

"This is a very simple NES demo, letting the player move a character between two stacks of crates. [...] Download NROM template 0.04 or SGROM/SNROM template 0.04 (source and NES binary)."

If you are looking for an example that uses CHR ROM, click "NROM template" on that page. If you are looking for an example that uses CHR RAM, click "SGROM/SNROM template" on that page. Download one of those examples, unzip it to a new folder, and follow the instructions in README.md to set up your build environment.

What program are you using to make the PNG or BMP files, so that I can walk you through converting each PNG file to indexed color so that these converters will read it correctly?
Re: Graphics - Tools
by on (#136824)
The program is called Pyxel Edit. It can export the tile set or complete image as PNG, JPG or GIF formats.

Thanks for you help!!!
Re: Graphics - Tools
by on (#137029)
Hello again Tepples. Have you had a chance to look into this further? I still cannot get the PNG files converted to CHR.

Thanks
Re: Graphics - Tools
by on (#137031)
8BitDreams wrote:
Have you had a chance to look into this further? I still cannot get the PNG files converted to CHR.

What error message are you getting? Or are you at a loss as to how to even start? What operating system are you using on your PC?
Re: Graphics - Tools
by on (#137168)
In YY-CHR I get "Bitmap Open Error" when I attempt to open a BMP file. That's the only message I get and all I can do is clock "OK". I've tried saving the file in Paint as 16 color and as monochrome but neither can be opened in YY-CHR.

I use Windows 7. At this point, yes, I'm at a loss as how to even start.
Re: Graphics - Tools
by on (#137169)
YY-CHR prefers images use 256-color palettes, even if you're only using 16 colors in the image.

There's also the option of copying the data from the clipboard to YY-CHR's 8bpp Bitmap tab (if you're using YY-CHR.NET, anyways), but you'll still need to have the image use a 256 color palette.
Re: Graphics - Tools
by on (#137172)
I just saved the image as 256 colors in Paint but I still get the same error message in YY-CHR. Is there a file size limit or something that I'm not aware of. The file I'm trying to open is 32x30 tiles.

I am using YY-CHR.NET and so I tried the copy/paste option but that isn't working. It just keeps pasting the previously selected tile in YY-CHR as if the clipboard is not transferring over from Paint.
Re: Graphics - Tools
by on (#137236)
To update my progress (or lack thereof), I tried using a very small 3-color image (16 x 32 pixels). I used both Paint and Photoshop to save it as a BMP. I've tried the 16-color and 256-color BMP options. I've tried the CHR ROM and 8bppp Bitmap tabs in YY-CHR. Nothing will open, I just keep getting the same generic "Bitmap Open Error" message. The copy and paste option into the 8bppp tab does absolutely nothing. Is this program incredibly user unfriendly or am I a complete half-wit? I will except either answer.

Thanks for whomever can help me get past step 1 of this issue!
Re: Graphics - Tools
by on (#137739)
After some BMP conversion struggles I am finally able to import a 32x30 tile BMP into NES Screen Tool, however all the tiles are being reduced to the colors of only one of the palettes. I set all four palettes to the colors I wish to use. Is there a way to import an image and maintain my color scheme for each tile?
Re: Graphics - Tools
by on (#137750)
Make your image, then reduce it to 4 colours. Quickly replace the attributes manually after importing.
Re: Graphics - Tools
by on (#137754)
If you're not scared by Python and the command line, try my converter. It takes an image and a palette and emits a project file containing CHR, NAM, and palette useful for a graphics editor that runs directly on the NES. From there you can pull the CHR and NAM out of the project file.
Re: Graphics - Tools
by on (#137756)
I am terrified of snakes so I will try rainwarrior's approach first. It'll take me a bit to "quickly" replace the attributes manually since I don't have much practice with this. Thanks for the replies!
Re: Graphics - Tools
by on (#137757)
To change the attributes, turn of "apply tiles" but leave "apply palettes" on (toggle "attr checker" if you want to view just the attributes). I say it's quick because the attribute table is just 16 x 15 entries, so should only take a few seconds to fill it in by hand.
Re: Graphics - Tools
by on (#137771)
This is working nicely for the most part, however...

I'm trying to import a four color image but it is importing as a three color image instead. The third color in the first palette is of NESST is not being applied to any of the pixels upon importing. I tried changing the color in MSPaint from dark gray to blue in case the dark gray color was being interpreted as the black but that did not change anything in NESST. Any ideas?
Re: Graphics - Tools
by on (#137773)
Could you post an example image that you're trying to import that's failing or something? Because like... I'm sure there's an easy workflow out there with a graphics editor that has actual palette control. I understand that maybe you want to keep your art secret, but even then it should be relatively easy to create a test image using the same colors or whatever, no? From there, we could give a list of steps like, "Load this image in this program, and do this, this and this." We can be sure it works with the exact kind of image you're trying to import before we post the advice. Instead of trying to figure out what's wrong from just your description.

Edit: For what it's worth, I own Pyxel Edit and can open a .pyxel.
Re: Graphics - Tools
by on (#137777)
When you import in NESST, it will select the closest colour from the currently selected palette. So... use those 4 colours (or make a palette that matches your image and select that). This is explained in the readme.txt that comes with it, by the way, if you haven't taken a look in there.
Re: Graphics - Tools
by on (#137812)
When I import an image into NESST Palette 0 changes to four "default" colors. I say "default" because it doesn't matter what I set them to or what image I import, they always revert back to these same four colors. I did read the readme and tried to set my desired colors to Palette 0 but as I said, they keep switching back to the "default" colors.

When I first open NESST Palette 0 is black, dark gray, light gray, white but no matter which image I import it changes to black, dark brown, green, light brown.

So I tried setting the colors in my image to match the palette and i tried setting the palette to match my image, both are yielding a result with only three colors in NESST.

Kasumi, can I send you the actual .pyxel file so you can see if you have success with it start to finish? If so, how is that done through this forum?
Re: Graphics - Tools
by on (#137813)
Oh, well if you're encountering a bug in the program, I'd suggest sending a report to Shiru about it.

(I've only ever used the BMP import for CHR import, but it's always worked like it says for me.)
Re: Graphics - Tools
by on (#137826)
8BitDreams wrote:
Kasumi, can I send you the actual .pyxel file so you can see if you have success with it start to finish? If so, how is that done through this forum?

You may, and you can do that through a PM. Underneath all of my posts is a PM button (next to the profile button). You can click that to send me a message. You can attach a file as well. (Underneath where you write the message, much like you can when just making a post.) You have to zip it (or just change it's extension to .zip) because the forum does not allow certain extensions. (Fun fact, a .pyxel is in fact a zip file with the tileset and other information as files within it.)

It does sound like a bug in the program, though. If it is, I can teach you to accomplish this with YY-CHR.

Edit: Nah, wasn't a bug in the program.