Problem with borrowed (opensource) graphics, can't edit them

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

User avatar
NeoTorpor
Posts: 23
Joined: Sat Oct 06, 2018 3:03 pm

Re: Problem with borrowed (opensource) graphics, can't edit

Post by NeoTorpor »

I am using a tool called makechr and it works with 3 and 4 colors images (16x16) but it doesn't work with SNES sprites converted to 4 colors even if i repaint them.
Harvest moon with swords is a terrific idea.
nocash
Posts: 1405
Joined: Fri Feb 24, 2012 12:09 pm
Contact:

Re: Problem with borrowed (opensource) graphics, can't edit

Post by nocash »

Okay, I think you are still miles away from NES graphics, or even from converting PC bitmaps graphics to NES graphics.
Before trying to do anything like that, you must first understand how to create a 4-color bitmaps (with normal PC tools, you don't need any special NES tools for that).

--- You need 2bpp bitmap format (bpp = bits per pixel) (with 4 colors)
--- What you have now is 24bpp bitmap format (with 16 million colors).

I have had a closer a look at the chick images, and they have even more colors than I had thought. The chick1 has 7 colors (or maybe 8 colors if you count the background separately). And the chick2 has 82 colors.

If you have Irfan View (or similar tools), you can these things:
--- Use the "Count Colors Used" function to see how many colors you have.
--- Use the "Decrease Color Depth" function to convert to 4-color (2bpp) format.
If decreasing color depth "erases" pixels:
--- First use the "Contrast" or "Gamma Correction" or "Edit Palette" functions before decreasing color depth.

Changing 24x24pix to 16x16pix: You can almost forget about that idea. It won't work. Or it would require a lot of manual editing.
In theory there are two ways, called Resize and Resample in Irfan View:
--- Resize "removes" pixels (a pair of black and white pixels will leave only one of them, the one other disappears).
--- Resample "merge pixels (a pair of black and white pixels will become gray; the downside is that you have more colors than before).
Converting from 24x24 to 16x16 (66.666% of original size) is a terrible idea anyways. The result would probably look much better if you keep it at 24x24. Or, use half size, ie. convert to 12x12 pixels (50% of original size), you may still need manual editing, but not so much as with other scale factors.
Of course, your 25x24pix image ruins all kind of attempts to use even scale factors. Use the "Crop" function in an image editor to crop to 24x24 pixels (=remove the rightmost extra 1x24pix).
homepage - patreon - you can think of a bit as a bottle that is either half full or half empty
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Problem with borrowed (opensource) graphics, can't edit

Post by dougeff »

Another option is to just redraw the graphics in a tool meant to make NES graphics.

NES screen tool
YY-CHR
Tile Layer Pro
Tile Molester
etc.
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
NeoTorpor
Posts: 23
Joined: Sat Oct 06, 2018 3:03 pm

Re: Problem with borrowed (opensource) graphics, can't edit

Post by NeoTorpor »

Hi, makechr (the tool i am using), uses a color palette (the nes one) and if i put another color not allowed by the nes palette, i get an error. So far i made a bit of progress because i am repainting the images i borrow but yy still pastes the images with crappy quality (something that doesn't happen in makechr if i get the colors right).

I am using gimp and when i convert the image to 4 colors, it often uses colors not allowed by makechr, the chicken had 2 kinds of gray even after i converted with gimp (4 colors), and thanks to your tool (nocash) i could see the extra colors. I am still a noob and my skills with gimp are pretty far from good.


@dougeff, YY-CHR puts a weird color for the background and maybe i am doing it wrong since one picture pastes right and the other ones get a weird background color or even more than 4 colors. Here is the image that pastes right in yy.
Attachments
carrot.bmp
carrot.bmp (246 Bytes) Viewed 10206 times
Harvest moon with swords is a terrific idea.
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Problem with borrowed (opensource) graphics, can't edit

Post by dougeff »

Pasting to YY-CHR does not save the color information. It only saves the "index" (and personally, I think it does it backwards).

Palettes (the actual color you see on a screen on a NES) have to be programmed in separately from the graphic file.

There is a color replace tool (looks like 3 squares with an arrow to 3 squares) to change the index of each color after you've pasted it in.

...edit ...so if you don't understand color index... when you reduce a file to indexed 4 color, somewhere in the file it has a list of the colors and it can order them in random ways... it could be black,red,blue,white... it could be blue,white,black,red... any order is possible... so you can't expect YY-CHR to know the correct order of each color.
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
gauauu
Posts: 779
Joined: Sat Jan 09, 2016 9:21 pm
Location: Central Illinois, USA
Contact:

Re: Problem with borrowed (opensource) graphics, can't edit

Post by gauauu »

I use gimp also for editing my graphics. I've found the easiest thing to do is use the colormap window to manage your colors. I almost ALWAYS convert everything to the same set of 4 colors, in the same order, so that it doesn't get confused when copying things around from image to image. You can click on a color in the colormap window, and change the color for that index, or you can right-click the colormap and choose to rearrange the map.

The way I use it, I always use #FF00FF for background color (so it's obvious), then black, gray, white for the other three colors. Picking a consistent set of colors and order of colors makes it a lot easier to copy and paste things around.

(Then at the end, instead of using something like YY-CHR, I use a python script to convert the indexed png file to chr format. There's an example script of how you might do that in Tepples' NROM Template)
User avatar
Kasumi
Posts: 1293
Joined: Wed Apr 02, 2008 2:09 pm

Re: Problem with borrowed (opensource) graphics, can't edit

Post by Kasumi »

You can give a shot to my tool which doesn't care about the specific colors you are using, and doesn't care about whether the image is indexed or not. It's designed to work with backgrounds, but this doesn't matter if all your sprites are tile aligned anyway.

Just keep in mind it works on PNG images, not BMP. After importing it will mark errors (if you use more than 4 colors in places an NES background wouldn't allow), or export NES ready files. (CHR.) Here it is working on the carrot image:
Image
You may find the colors strange. For this reason, I-CHR also exports a palette:
Image
You want to open a palette set (the option may have slightly different text, there are lots of yy-chr versions around). You need to select all files as a filter, since yy-chr wants the .dat extension by default, but I-CHR exports .pal.

Because I-CHR doesn't care about color order as much, you may find you need to remap the palette. This is how you do this in (one version of) YY-CHR, if for example, green was supposed to be the transparent color instead:
Image

And then, assuming you have multiple chr files you want to condense into one set, you can open all of them in one instance of YY-CHR and copy/paste them into the "final" arrangement.

I made a zip of blank chr files here: https://forums.nesdev.com/viewtopic.php ... 47#p136347

When YY-CHR saves, it uses the same size file. So open up the 8KB file (NROM's limit), and paste your tiles into it, then save that. Consider it your "master" tile file.
Image
Two different versions of YY-CHR, whoops!
Edit: To select a portion of tiles, right click and drag. ctrl+c copies, ctrl+v pastes.
Note that it's up to you to make sure the palette indices correspond properly. You can remap a specific selection of tiles by right click and dragging, and doing the remap palette step. (Shown for the carrot a little above.) It will only change the tiles that have been selected.


All of that doesn't really help you with getting existing art down to four colors. I might make another post about that. The tool I use makes it pretty easy (Aseprite), but it's non free (unless you compile it.)
User avatar
NeoTorpor
Posts: 23
Joined: Sat Oct 06, 2018 3:03 pm

Re: Problem with borrowed (opensource) graphics, can't edit

Post by NeoTorpor »

Thank you @dougeff @gauauu @Kasumi

With Kasumi's tool i made this rom (i used copyright material but for experimental purposes only). It's a rom with the SNES hen from Harvest Moon. I am far from understating 100% of the process so i will pester you guys with questions as soon as i try to make the hen move.

Thank you.
Attachments
hen.nes
(24.02 KiB) Downloaded 375 times
Harvest moon with swords is a terrific idea.
Post Reply